[PATCH] posix: Ensure the initial signal disposition for tst-spawn7

Florian Weimer fweimer@redhat.com
Wed Mar 8 09:44:07 GMT 2023


* Adhemerval Zanella via Libc-alpha:

> To avoid possible failure if any parent set any initial signal
> disposition as SIG_IGN.
>
> Checked on x86_64-linux-gnu.
> ---
>  posix/tst-spawn7.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/posix/tst-spawn7.c b/posix/tst-spawn7.c
> index fedb09fb94..fb06915cb7 100644
> --- a/posix/tst-spawn7.c
> +++ b/posix/tst-spawn7.c
> @@ -99,6 +99,12 @@ dummy_sa_handler (int signal)
>  static void
>  do_test_signals (void)
>  {
> +  /* Ensure the initial signal disposition, ignore EINVAL for internal
> +     signal such as SIGCANCEL.  */
> +  for (int sig = 1; sig < _NSIG; ++sig)
> +    sigaction (sig, &(struct sigaction) { .sa_handler = SIG_DFL,
> +					  .sa_flags = 0 }, NULL);
> +
>    {
>      /* Check if all signals handler are set to SIG_DFL on spawned process.  */
>      spawn_signal_test ("SIG_DFL", NULL);

Finally found out what's causing my failure: running the test suite with
“nohup”.  Maybe you could mention this in the comment?  Anyway, the
patch is fixing things.

I suspect H.J. is doing the same. 8-)

Tested-by: Florian Weimer <fweimer@redhat.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian



More information about the Libc-alpha mailing list