]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
test/sanitytest.c: fix setitimer usage in timer disarmament openssl-3.4
authorEugene Syromiatnikov <esyr@openssl.org>
Sun, 10 Aug 2025 00:00:25 +0000 (02:00 +0200)
committerTomas Mraz <tomas@openssl.org>
Mon, 11 Aug 2025 14:58:24 +0000 (16:58 +0200)
It is incorrect to call setitimer(which, NULL, NULL) to disarm a timer,
Linux just gives a pass on that;  properly provide a zeroed-out
structure instead.

Fixes: 760929f6ba18 "crypto/sleep.c: avoid returning early due to signal"
Reported-by: Neil Horman <nhorman@openssl.org>
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/28215)

(cherry picked from commit 1b1a859d3d8aafbdda2977f9955ceee6f32f7ea4)

test/sanitytest.c

index 0b4d4a6a7c3465cb80bf18bb1ed1a5b86888520c..282ad64f1ac6ceab76f6f6fd85ac7c885439af6c 100644 (file)
@@ -192,7 +192,9 @@ static int test_sanity_sleep(int i)
 #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L
     /* disarm the timer */
     do {
-        if (setitimer(ITIMER_REAL, NULL, NULL)) {
+        static const struct itimerval it;
+
+        if (setitimer(ITIMER_REAL, &it, NULL)) {
             TEST_perror("test_sanity_sleep: disarm setitimer");
             break;
         }