aboutsummaryrefslogtreecommitdiffstats
path: root/src/system-posix.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-11-15 14:43:24 +0000
committerWerner Koch <[email protected]>2017-11-15 14:43:24 +0000
commit7b408d356094ab0ef0a07904a3ddf3832a8aa197 (patch)
treeba0492d4eb6440981fce72f9693d6df96352d359 /src/system-posix.c
parentWe can't support fd passing, if the system doesn't support it. (diff)
downloadlibassuan-7b408d356094ab0ef0a07904a3ddf3832a8aa197.tar.gz
libassuan-7b408d356094ab0ef0a07904a3ddf3832a8aa197.zip
Fix the nanosleep case of __assuan_usleep.
* src/system-posix.c (__assuan_usleep): Handle full seconds. -- This function would have failed for any value >= 1000000 because the nsec field is limited to 999999999 and the function fails for larger values. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/system-posix.c')
-rw-r--r--src/system-posix.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/system-posix.c b/src/system-posix.c
index 52376da..65d2c8c 100644
--- a/src/system-posix.c
+++ b/src/system-posix.c
@@ -68,9 +68,8 @@ __assuan_usleep (assuan_context_t ctx, unsigned int usec)
struct timespec req;
struct timespec rem;
- req.tv_sec = 0;
- req.tv_nsec = usec * 1000;
-
+ req.tv_sec = usecs / 1000000;
+ req.tv_nsec = (usecs % 1000000) * 1000;
while (nanosleep (&req, &rem) < 0 && errno == EINTR)
req = rem;
}