]> git.ipfire.org Git - thirdparty/git.git/commitdiff
compat/mingw: allow sigaction(SIGCHLD)
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Thu, 10 Jul 2025 19:45:42 +0000 (19:45 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 10 Jul 2025 21:19:15 +0000 (14:19 -0700)
A future change will start using sigaction to setup a SIGCHLD signal
handler.

The current code uses signal(), which returns SIG_ERR (but doesn't
seem to set errno) so instruct sigaction() to do the same.

A new SA flag will be needed, so copy the one from Cygwin; note that
the sigaction() implementation that is provided won't use it, so
its value is otherwise irrelevant.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/mingw-posix.h
compat/mingw.c

index 88e0cf92924bd9bcbbe7f42282b7590856a0057e..631a20868489bef8a21e65ca3a9e53b4f68fada0 100644 (file)
@@ -96,6 +96,7 @@ struct sigaction {
        unsigned sa_flags;
 };
 #define SA_RESTART 0
+#define SA_NOCLDSTOP 1
 
 struct itimerval {
        struct timeval it_value, it_interval;
index 8a9972a1ca19f7f768e2491ce1a90babd75f6bb9..5d69ae32f4b946459c183d9106e3d212e0cb9a53 100644 (file)
@@ -2561,7 +2561,9 @@ int setitimer(int type UNUSED, struct itimerval *in, struct itimerval *out)
 
 int sigaction(int sig, struct sigaction *in, struct sigaction *out)
 {
-       if (sig != SIGALRM)
+       if (sig == SIGCHLD)
+               return -1;
+       else if (sig != SIGALRM)
                return errno = EINVAL,
                        error("sigaction only implemented for SIGALRM");
        if (out)