]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Define static set_cloexec() only when really used
authorMilan Broz <gmazyland@gmail.com>
Fri, 27 Mar 2026 09:39:56 +0000 (10:39 +0100)
committerEugene Syromiatnikov <esyr@openssl.org>
Tue, 31 Mar 2026 00:21:33 +0000 (02:21 +0200)
Statically defined set_cloexec helper is used only
if RIO_NOTIFIER_METHOD_SOCKET is set (for non-Windows branch)
and if RIO_NOTIFIER_METHOD_SOCKETPAIR is set
(always).

This avoids unused code warnings.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Tue Mar 31 00:22:26 2026
(Merged from https://github.com/openssl/openssl/pull/30616)

ssl/rio/rio_notifier.c

index 0d84880065d42a21870972f2120c4c77824065b0..ab635aa7a0bee3f8e23c70fe484643b991dd2337 100644 (file)
@@ -13,6 +13,7 @@
 #include "internal/thread_once.h"
 #include "internal/rio_notifier.h"
 
+#if !defined(OPENSSL_SYS_WINDOWS) || RIO_NOTIFIER_METHOD == RIO_NOTIFIER_METHOD_SOCKETPAIR
 /*
  * Sets a socket as close-on-exec, except that this is a no-op if we are certain
  * we do not need to do this or the OS does not support the concept.
@@ -25,6 +26,7 @@ static int set_cloexec(int fd)
     return 1;
 #endif
 }
+#endif
 
 #if defined(OPENSSL_SYS_WINDOWS)