Skip to content

Commit ef03aa4

Browse files
carenasgitster
authored andcommitted
compat/mingw: allow sigaction(SIGCHLD)
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cb3b403 commit ef03aa4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compat/mingw-posix.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ struct sigaction {
9696
unsigned sa_flags;
9797
};
9898
#define SA_RESTART 0
99+
#define SA_NOCLDSTOP 1
99100

100101
struct itimerval {
101102
struct timeval it_value, it_interval;

compat/mingw.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2561,7 +2561,9 @@ int setitimer(int type UNUSED, struct itimerval *in, struct itimerval *out)
25612561

25622562
int sigaction(int sig, struct sigaction *in, struct sigaction *out)
25632563
{
2564-
if (sig != SIGALRM)
2564+
if (sig == SIGCHLD)
2565+
return -1;
2566+
else if (sig != SIGALRM)
25652567
return errno = EINVAL,
25662568
error("sigaction only implemented for SIGALRM");
25672569
if (out)

0 commit comments

Comments
 (0)