tdb: Fix bug 7248, avoid the nanosleep dependency
authorVolker Lendecke <vl@samba.org>
Thu, 22 Apr 2010 04:24:06 +0000 (13:54 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 22 Apr 2010 04:24:06 +0000 (13:54 +0930)
(Imported from commit e2c7e5c4f72565fe49265d5b036531926ea1ac92)

lib/tdb/tools/tdbtorture.c

index 5ee6991825b859975a3aa8fab0eee18f547bf726..eda79f83d8ee726f6f6f1405a8830d68ad5c84c1 100644 (file)
@@ -355,12 +355,12 @@ int main(int argc, char * const *argv)
 
                pid = waitpid(-1, &status, kill_random ? WNOHANG : 0);
                if (pid == 0) {
-                       struct timespec ts;
+                       struct timeval tv;
 
                        /* Sleep for 1/10 second. */
-                       ts.tv_sec = 0;
-                       ts.tv_nsec = 100000000;
-                       nanosleep(&ts, NULL);
+                       tv.tv_sec = 0;
+                       tv.tv_usec = 100000;
+                       select(0, NULL, NULL, NULL, &tv);
 
                        /* Kill someone. */
                        kill(pids[random() % num_procs], SIGUSR1);