From c88ea2f54aa76f29aa538a74e262221ed66c5c58 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 8 Jun 2020 21:53:41 +0200 Subject: [PATCH] LibC: Add nanosleep() wrapper around clock_nanosleep(CLOCK_REALTIME) Gets rid of one dropbear patch. :^) --- Libraries/LibC/time.cpp | 5 +++++ Libraries/LibC/time.h | 1 + Ports/dropbear/patches/remove-nanosleep.patch | 11 ----------- 3 files changed, 6 insertions(+), 11 deletions(-) delete mode 100644 Ports/dropbear/patches/remove-nanosleep.patch diff --git a/Libraries/LibC/time.cpp b/Libraries/LibC/time.cpp index 4d19b2134b..b4a60614d4 100644 --- a/Libraries/LibC/time.cpp +++ b/Libraries/LibC/time.cpp @@ -330,6 +330,11 @@ int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec* reques __RETURN_WITH_ERRNO(rc, rc, -1); } +int nanosleep(const struct timespec* requested_sleep, struct timespec* remaining_sleep) +{ + return clock_nanosleep(CLOCK_REALTIME, 0, requested_sleep, remaining_sleep); +} + int clock_getres(clockid_t, struct timespec*) { ASSERT_NOT_REACHED(); diff --git a/Libraries/LibC/time.h b/Libraries/LibC/time.h index 3fa28ca5d8..4398dbaf3a 100644 --- a/Libraries/LibC/time.h +++ b/Libraries/LibC/time.h @@ -77,6 +77,7 @@ int clock_gettime(clockid_t, struct timespec*); int clock_settime(clockid_t, struct timespec*); int clock_nanosleep(clockid_t, int flags, const struct timespec* requested_sleep, struct timespec* remaining_sleep); int clock_getres(clockid_t, struct timespec* result); +int nanosleep(const struct timespec* requested_sleep, struct timespec* remaining_sleep); struct tm* gmtime_r(const time_t* timep, struct tm* result); struct tm* localtime_r(const time_t* timep, struct tm* result); diff --git a/Ports/dropbear/patches/remove-nanosleep.patch b/Ports/dropbear/patches/remove-nanosleep.patch deleted file mode 100644 index e0466f46f1..0000000000 --- a/Ports/dropbear/patches/remove-nanosleep.patch +++ /dev/null @@ -1,11 +0,0 @@ -Hinders security by a little, but I guess we'll just have nanosleep soon enough. ---- a/svr-auth.c.orig -+++ b/svr-auth.c -@@ -424,7 +424,6 @@ - if (!fuzz.fuzzing) - #endif - { -- while (nanosleep(&delay, &delay) == -1 && errno == EINTR) { /* Go back to sleep */ } - } - - ses.authstate.failcount++;