signal: Avoid system signal disposition to interfere with tests

Message ID 20240312173649.1549645-1-adhemerval.zanella@linaro.org
State Committed
Commit 2e53eb923486704b7a0d6f3d81d1ee8ba672a56b
Delegated to: Florian Weimer
Headers
Series signal: Avoid system signal disposition to interfere with tests |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Testing passed

Commit Message

Adhemerval Zanella Netto March 12, 2024, 5:36 p.m. UTC
  Both tst-sigset2 and tst-signal1 expectes that SIGINT disposition
is set to SIG_DFL.
---
 signal/tst-sigset2.c          | 4 ++++
 sysdeps/pthread/tst-signal1.c | 3 +++
 2 files changed, 7 insertions(+)
  

Patch

diff --git a/signal/tst-sigset2.c b/signal/tst-sigset2.c
index 4eef653f95..c1d125e4cb 100644
--- a/signal/tst-sigset2.c
+++ b/signal/tst-sigset2.c
@@ -11,6 +11,8 @@ 
 #include <sys/wait.h>
 #include <libc-diag.h>
 
+#include <support/xsignal.h>
+
 /* The sigset function is deprecated.  */
 DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wdeprecated-declarations");
 
@@ -148,6 +150,8 @@  returnTest3 (void)
 int
 main (int argc, char *argv[])
 {
+  xsignal (TEST_SIG, SIG_DFL);
+
   pid_t childPid;
 
   childPid = fork();
diff --git a/sysdeps/pthread/tst-signal1.c b/sysdeps/pthread/tst-signal1.c
index 1c550ef8eb..ca145eef3d 100644
--- a/sysdeps/pthread/tst-signal1.c
+++ b/sysdeps/pthread/tst-signal1.c
@@ -26,6 +26,7 @@ 
 #include <sys/wait.h>
 
 #include <support/xunistd.h>
+#include <support/xsignal.h>
 
 static sigset_t ss;
 static pthread_barrier_t *b;
@@ -93,6 +94,8 @@  receiver (void)
 static int
 do_test (void)
 {
+  xsignal (SIGINT, SIG_DFL);
+
   char tmp[] = "/tmp/tst-signal1-XXXXXX";
 
   int fd = mkstemp (tmp);