mirror of
https://github.com/nmap/nmap.git
synced 2026-01-14 18:39:03 +00:00
POSIX usleep() returns an int.
This commit is contained in:
@@ -378,7 +378,7 @@ char *socket_strerror(int errnum);
|
||||
/* The usleep() function is important as well */
|
||||
#ifndef HAVE_USLEEP
|
||||
#if defined( HAVE_NANOSLEEP) || defined(WIN32)
|
||||
void usleep(unsigned long usec);
|
||||
int usleep(unsigned long usec);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -72,14 +72,15 @@
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_USLEEP
|
||||
void usleep(unsigned long usec) {
|
||||
int usleep(unsigned long usec) {
|
||||
#ifdef HAVE_NANOSLEEP
|
||||
struct timespec ts;
|
||||
ts.tv_sec = usec / 1000000;
|
||||
ts.tv_nsec = (usec % 1000000) * 1000;
|
||||
nanosleep(&ts, NULL);
|
||||
return nanosleep(&ts, NULL);
|
||||
#else /* Windows style */
|
||||
Sleep( usec / 1000 );
|
||||
return 0;
|
||||
#endif /* HAVE_NANOSLEEP */
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user