summaryrefslogtreecommitdiffstats
path: root/crypto/sleep.c
diff options
context:
space:
mode:
authorRandall S. Becker <randall.becker@nexbridge.ca>2024-03-30 23:28:02 +0100
committerTomas Mraz <tomas@openssl.org>2024-04-05 16:07:47 +0200
commit0d2a5f600c7b6bef6fa6cf720204876560a6194b (patch)
tree1daf9f20a0ccbecf22fbccc704a056b1ea949653 /crypto/sleep.c
parentDiverse small VMS build fixups (diff)
downloadopenssl-0d2a5f600c7b6bef6fa6cf720204876560a6194b.tar.xz
openssl-0d2a5f600c7b6bef6fa6cf720204876560a6194b.zip
NonStop: Do not call sleep() with a 0 value
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)
Diffstat (limited to '')
-rw-r--r--crypto/sleep.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/sleep.c b/crypto/sleep.c
index ce75c7a033..0d6432262c 100644
--- a/crypto/sleep.c
+++ b/crypto/sleep.c
@@ -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
}