From b1bfc5c69f6613ce09fb9855500a09c08a3041df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Mon, 28 Feb 2005 11:41:39 +0000 Subject: [PATCH] if you want to return something at least be consistent with the version of usleep which returns an int... (return -1 and set errno) see http://www.die.net/doc/linux/man/man3/usleep.3.html git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11510 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/unistd/usleep.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/kernel/libroot/posix/unistd/usleep.c b/src/kernel/libroot/posix/unistd/usleep.c index de8d5f2669..d8ca9f0785 100644 --- a/src/kernel/libroot/posix/unistd/usleep.c +++ b/src/kernel/libroot/posix/unistd/usleep.c @@ -5,10 +5,16 @@ #include #include - +#include int usleep(unsigned useconds) { - return snooze_until(system_time() + (bigtime_t)(useconds), B_SYSTEM_TIMEBASE); + int err; + err = snooze_until(system_time() + (bigtime_t)(useconds), B_SYSTEM_TIMEBASE); + if (err < 0) { + errno = err; + return -1; + } + return 0; }