From 976ae64f88d1c9500afdbde85a2408234c71e3cd Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 6 Dec 2023 13:13:43 +0200 Subject: [PATCH] LibC: make sleep() set errno if sleep woke up early --- libc/unistd.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libc/unistd.cpp b/libc/unistd.cpp index 7b401d49..ced04a3e 100644 --- a/libc/unistd.cpp +++ b/libc/unistd.cpp @@ -192,7 +192,10 @@ int pipe(int fildes[2]) unsigned int sleep(unsigned int seconds) { - return syscall(SYS_SLEEP, seconds); + unsigned int ret = syscall(SYS_SLEEP, seconds); + if (ret > 0) + errno = EINTR; + return ret; } char* getcwd(char* buf, size_t size)