aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-06-27 21:51:54 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-06-27 21:51:54 +0000
commita7b99fc46339d0c3e1f2c095df371a7c88ed7907 (patch)
treea36bf361acab8182f6f964e2c4d99628872bce1f /src
parent6f252f470470698ff08cffc23daa7276bbc8d327 (diff)
check for a fine poll() before it is used to sleep subsecond
Diffstat (limited to 'src')
-rw-r--r--src/config.h.in3
-rw-r--r--src/main.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/config.h.in b/src/config.h.in
index ca36f2b3f..7c5a957db 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -35,6 +35,9 @@
/* Define if you have the `poll' function. */
#undef HAVE_POLL
+/* Define if you have a good `poll' function that can wait on NULL. */
+#undef HAVE_POLL_FINE
+
/* Define if you can write to argc[] strings */
#undef HAVE_WRITABLE_ARGV
diff --git a/src/main.c b/src/main.c
index 0a5624ba1..126fa4af0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2243,7 +2243,7 @@ static void parseconfig(const char *filename,
static void go_sleep(long ms)
{
-#ifdef HAVE_POLL
+#ifdef HAVE_POLL_FINE
/* portable subsecond "sleep" */
poll((void *)0, 0, ms);
#else
@@ -2259,7 +2259,7 @@ static void go_sleep(long ms)
struct timeval timeout;
timeout.tv_sec = ms/1000;
- ms -= ms/1000;
+ ms = ms%1000;
timeout.tv_usec = ms * 1000;
select(0, NULL, NULL, NULL, &timeout);