From dc99d9a487fb8b99dcd70ac770ce0dd68cddaa07 Mon Sep 17 00:00:00 2001 From: hniksic Date: Sat, 24 Jan 2004 19:16:33 -0800 Subject: [PATCH] [svn] Don't sleep using usleep for more than a second. --- src/ChangeLog | 5 +++++ src/utils.c | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4cd4fa33..05824376 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-01-25 Hrvoje Niksic + + * utils.c (xsleep): Don't call usleep with values larger than + 1,000,000. + 2003-12-16 Hrvoje Niksic * http.c (gethttp): Fix generation of `Content-Length'. diff --git a/src/utils.c b/src/utils.c index c83e4499..c9de2ea2 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1954,11 +1954,10 @@ xsleep (double seconds) #else /* not HAVE_NANOSLEEP */ #ifdef HAVE_USLEEP /* If usleep is available, use it in preference to select. */ - if (seconds > 1000) + if (seconds >= 1) { - /* usleep apparently accepts unsigned long, which means it can't - sleep longer than ~70 min (35min if signed). If the period - is larger than what usleep can safely handle, use sleep + /* On some systems, usleep cannot handle values larger than + 1,000,000. If the period is larger than that, use sleep first, then add usleep for subsecond accuracy. */ sleep (seconds); seconds -= (long) seconds; -- 2.39.2