Skip to contentSkip to conversation

sig.c: define signal_handler on non-windows only

PATCH In review Antonio Quartulli 2 participants 2 messages Jan 13, 2022 – Jan 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sig.c: define signal_handler on non-windows only

signal_handler() is unused on Windows and generates a warning. Confine it within "ifdef _WIN32" in order to reduce the compilation noise.

---
 src/openvpn/sig.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/openvpn/sig.c +2 -1
index eadd7109..9747c083 100644
@@ -214,7 +214,7 @@ signal_restart_status(const struct signal_info *si)
 #endif /* ifdef ENABLE_MANAGEMENT */
 }
 
-
+#ifndef _WIN32
 /* normal signal handler, when we are in event loop */
 static void
 signal_handler(const int signum)
@@ -222,6 +222,7 @@ signal_handler(const int signum)
     throw_signal(signum);
     signal(signum, signal_handler);
 }
+#endif
 
 
 /* set handlers for unix signals */
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw

"makes sense". Have not tested this.

(The result is still not pretty... maybe a better approach would be to have all the "not win32" signal stuff in a single #ifdef, and add empty do-nothing pre_init_signal_catch() etc. functions for WIN32
- but that's another patch for another day)

Your patch has been applied to the master branch.

commit 508ee74a9671d0175afeeb1711ba0f18d538cfb2

Author: Antonio Quartulli
Date:   Thu Jan 13 11:14:34 2022 +0100
     sig.c: define signal_handler on non-windows only

     Signed-off-by: Antonio Quartulli <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg23530.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering