1
0
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:
dmiller
2024-10-28 23:17:05 +00:00
parent f0c022b25f
commit fef9f592b0
2 changed files with 4 additions and 3 deletions

View File

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

View File

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