aboutsummaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>2023-03-07 13:31:52 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-03-08 10:08:40 -0300
commit65387e48097077c71ed527457c59ba59f3a1f3ee (patch)
treef8242d44acf8e5a6e126f7cced7e1710781f779a /posix
parentd03094649d39949a30513bf3ffb03a28fecbccd8 (diff)
downloadglibc-65387e48097077c71ed527457c59ba59f3a1f3ee.zip
glibc-65387e48097077c71ed527457c59ba59f3a1f3ee.tar.gz
glibc-65387e48097077c71ed527457c59ba59f3a1f3ee.tar.bz2
posix: Ensure the initial signal disposition for tst-spawn7
To avoid possible failure if any parent set any initial signal disposition as SIG_IGN (for instance if the testcase is issued with nohup). Checked on x86_64-linux-gnu. Tested-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'posix')
-rw-r--r--posix/tst-spawn7.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/posix/tst-spawn7.c b/posix/tst-spawn7.c
index fedb09f..fb06915 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);