mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 08:46:58 +08:00
ms_sleep: do wait for the specified amount of time
That is, do not return earlier due to a signal. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <nettle/base64.h>
|
||||
#include <errno.h>
|
||||
|
||||
void _talloc_free2(void *ctx, void *ptr);
|
||||
void *_talloc_size2(void *ctx, size_t size);
|
||||
@@ -109,6 +110,7 @@ inline static
|
||||
void ms_sleep(unsigned ms)
|
||||
{
|
||||
struct timespec tv;
|
||||
int ret;
|
||||
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_nsec = ms * 1000 * 1000;
|
||||
@@ -117,8 +119,10 @@ void ms_sleep(unsigned ms)
|
||||
tv.tv_nsec -= 1000000000;
|
||||
tv.tv_sec++;
|
||||
}
|
||||
|
||||
nanosleep(&tv, NULL);
|
||||
|
||||
do {
|
||||
ret = nanosleep(&tv, NULL);
|
||||
} while(ret == -1 && errno == EINTR);
|
||||
}
|
||||
|
||||
const char *ps_status_to_str(int status, unsigned cookie);
|
||||
|
||||
Reference in New Issue
Block a user