Re: [PATCH v3 2/4] compat/mingw: allow sigaction(SIGCHLD)
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Jun 26, 2025, 12:52 UTC
- Message-ID
- <49cf7749-fc86-4829-8e94-c1f1e87803aa@gmail.com>
- In-Reply-To
- <3f63479119ffe6fdcf694dac3cb47cd7838564b7.1750927989.git.gitgitgadget@gmail.com>
On 26/06/2025 09:53, Carlo Marcelo Arenas Belón via GitGitGadget wrote:
Show 7 quoted lines
> From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <carenas@gmail.com> > > 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.
Why are we returning -1 below instead of SIG_ERR if we want the behavior to match?
Thanks
Phillip
Show 34 quoted lines
>
> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
> ---
> compat/mingw-posix.h | 1 +
> compat/mingw.c | 4 +++-
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/compat/mingw-posix.h b/compat/mingw-posix.h
> index a0dca756d104..847d558c9b2d 100644
> --- a/compat/mingw-posix.h
> +++ b/compat/mingw-posix.h
> @@ -95,6 +95,7 @@ struct sigaction {
> sig_handler_t sa_handler;
> unsigned sa_flags;
> };
> +#define SA_NOCLDSTOP 1
>
> struct itimerval {
> struct timeval it_value, it_interval;
> diff --git a/compat/mingw.c b/compat/mingw.c
> index 8a9972a1ca19..5d69ae32f4b9 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -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)