From 4c7694fc58abbb5a2f89cc54b427c146345f436c Mon Sep 17 00:00:00 2001 From: Andriy Utkin Date: Thu, 12 Dec 2024 13:56:09 +0000 Subject: [PATCH] Fix setting SIG_IGN handler for SIGCHLD, SIGPIPE Caught thanks to Ubuntu 24.10 giving compilation error: ccache gcc -std=c99 -Wall -g3 -ggdb -O3 -isystem /build/source/stage/include -iquote /build/source/lib -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -I /usr/include/opencv4 -pthread -MMD -DV3_LICENSING -I//build/source/server/lexapi -DBC_VERSION='"3.1.8"' -Wdate-time -D_FORTIFY_SOURCE=3 -c -o signals.o signals.c signals.c: In function 'signals_setup': signals.c:61:25: error: assignment to 'void (*)(int, siginfo_t *, void *)' from incompatible pointer type 'void (*)(int)' [-Wincompatible-pointer-types] 61 | sa.sa_sigaction = SIG_IGN; | ^ make[2]: *** [: signals.o] Error 1 --- server/signals.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/signals.c b/server/signals.c index 64ee60db..7a5ee28e 100644 --- a/server/signals.c +++ b/server/signals.c @@ -58,7 +58,9 @@ void signals_setup() } // these signals are ignored: - sa.sa_sigaction = SIG_IGN; + memset(&sa, 0, sizeof(sa)); + sa.sa_flags = SA_NOCLDWAIT; + sa.sa_handler = SIG_IGN; ret = sigaction(SIGCHLD, &sa, NULL); assert(!ret); ret = sigaction(SIGPIPE, &sa, NULL);