Просмотр исходного кода

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
Родитель
Сommit
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)