瀏覽代碼

libdpkg: Set used signals in test suite to their default action

This fixes build failures when SIGINT, SIGTERM or SIGPIPE are set to
ignore the signals.
Guillem Jover 11 年之前
父節點
當前提交
14dff6e0c3
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 3 0
      debian/changelog
  2. 7 0
      lib/dpkg/t/t-subproc.c

+ 3 - 0
debian/changelog

@@ -59,6 +59,9 @@ dpkg (1.18.2) UNRELEASED; urgency=low
     - Future-proof tar invocations in Dpkg::Source::Archive for options that
       might become positional in the future, and by always placing function
       options first.
+  * Test suite:
+    - Set SIGINT, SIGTERM and SIGPIPE to their default actions to get
+      deterministic behavior.
   * Packaging:
     - Make the libdpkg-dev package Multi-Arch:same.
     - Mark libio-string-perl as <!nocheck>.

+ 7 - 0
lib/dpkg/t/t-subproc.c

@@ -34,9 +34,16 @@
 static void
 test_subproc_fork(void)
 {
+	struct sigaction sa;
 	pid_t pid;
 	int ret;
 
+	memset(&sa, 0, sizeof(sa));
+	sa.sa_handler = SIG_DFL;
+	sigaction(SIGINT, &sa, NULL);
+	sigaction(SIGTERM, &sa, NULL);
+	sigaction(SIGPIPE, &sa, NULL);
+
 	/* Test exit(). */
 	pid = subproc_fork();
 	if (pid == 0)