From 855a496c945a454b7b4b6183217f3e7ea546d1c0 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Thu, 16 Oct 1997 21:31:43 +0000 Subject: [PATCH] Copy time_to_sleep to time_remaining since it can be left uninitialized if nanosleep returns early with agr error --- lib/libc/gen/sleep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libc/gen/sleep.c b/lib/libc/gen/sleep.c index f7f775903c13..c68aa3d9f689 100644 --- a/lib/libc/gen/sleep.c +++ b/lib/libc/gen/sleep.c @@ -48,6 +48,7 @@ sleep(seconds) if (seconds != 0) { time_to_sleep.tv_sec = seconds; time_to_sleep.tv_nsec = 0; + time_remaining = time_to_sleep; (void)nanosleep(&time_to_sleep, &time_remaining); seconds = time_remaining.tv_sec; if (time_remaining.tv_nsec > 0)