From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id A07913850869; Wed, 8 Mar 2023 13:09:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A07913850869 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678280992; bh=HOcy8excjNqx01MVRlFrQljwL6cl7do9FGlk9tN/xuQ=; h=From:To:Subject:Date:From; b=h3GOcMM+Ui6CqRuCfnXGSe03WLHKcZYXl/EZ/dJ1L39UI4OUpfdv9k5KI7Yxijc1S TqywidJHtKYmi7tMtqIdcu8PPLL2Dmtf73y+LOKn+b+SAzis4iHXKZdFEP+UELLHSl lv4K0BIIYhmxBnZzBXEcPHoIav71drWG6Oglm0uw= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] posix: Ensure the initial signal disposition for tst-spawn7 X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella Netto X-Git-Refname: refs/heads/master X-Git-Oldrev: d03094649d39949a30513bf3ffb03a28fecbccd8 X-Git-Newrev: 65387e48097077c71ed527457c59ba59f3a1f3ee Message-Id: <20230308130952.A07913850869@sourceware.org> Date: Wed, 8 Mar 2023 13:09:52 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=65387e48097077c71ed527457c59ba59f3a1f3ee commit 65387e48097077c71ed527457c59ba59f3a1f3ee Author: Adhemerval Zanella Netto Date: Tue Mar 7 13:31:52 2023 -0300 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 Reviewed-by: Florian Weimer Diff: --- 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);