Copy time_to_sleep to time_remaining since it can be left

uninitialized if nanosleep returns early with agr error
This commit is contained in:
Andrey A. Chernov 1997-10-16 21:31:43 +00:00
parent 987f569678
commit 855a496c94

View File

@ -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)