]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
NonStop: Do not call sleep() with a 0 value
authorRandall S. Becker <randall.becker@nexbridge.ca>
Sat, 30 Mar 2024 22:28:02 +0000 (22:28 +0000)
committerTomas Mraz <tomas@openssl.org>
Fri, 5 Apr 2024 14:07:47 +0000 (16:07 +0200)
This change ensures that sleep(0) is not invoked to cause unexpected
duplicate thread context switches when _REENTRANT is specified.

Fixes: #24009
Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24012)

(cherry picked from commit c89fe574493f438dd0e94bb9a89227e4ca84c0b7)

crypto/sleep.c

index ce75c7a0330dc18dad858ded343c22e0a2d83fae..0d6432262c13c52920d47448e8e8593138147a64 100644 (file)
@@ -31,7 +31,8 @@ void OSSL_sleep(uint64_t millis)
     unsigned int s = (unsigned int)(millis / 1000);
     unsigned int us = (unsigned int)((millis % 1000) * 1000);
 
-    sleep(s);
+    if (s > 0)
+        sleep(s);
     usleep(us);
 # endif
 }