[PATCH 2/5] sulogin: make usleep() workaround work

Werner Fink
2012-12-07T08:22:06Z

Simply fix a compile problem found during debugging console.c

Signed-off-by: Werner Fink <werner@suse.de>
---
include/c.h | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git include/c.h include/c.h
index 1107287..ec1020e 100644
--- include/c.h
+++ include/c.h
@@ -19,6 +19,10 @@
# include <err.h>
#endif

+#ifndef HAVE_USLEEP
+# include <time.h>
+#endif
+
/*
* Compiler specific stuff
*/
@@ -246,13 +250,13 @@ static inline size_t get_hostname_max(void)
* This function is marked obsolete in POSIX.1-2001 and removed in
* POSIX.1-2008. It is replaced with nanosleep().
*/
-static inline usleep(useconds_t usec)
+static inline int usleep(useconds_t usec)
{
struct timespec waittime = {
.tv_sec = usec / 1000000L,
.tv_nsec = (usec % 1000000L) * 1000
- }
- nanosleep(&waittime, NULL);
+ };
+ return nanosleep(&waittime, NULL);
}
#endif

--
1.7.10.4