[pkg-opensc-commit] [libp11] 16/67: fork-test improved to handle child processes terminated with a signal

Eric Dorland eric at moszumanska.debian.org
Sat Jan 30 05:34:13 UTC 2016


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libp11.

commit e563db686783baf1db48daabeae9c0be9367bdd5
Author: Michal Trojnara <Michal.Trojnara at mirt.net>
Date:   Mon Dec 21 08:17:50 2015 +0100

    fork-test improved to handle child processes terminated with a signal
---
 tests/fork-test.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/fork-test.c b/tests/fork-test.c
index 89220be..3acd498 100644
--- a/tests/fork-test.c
+++ b/tests/fork-test.c
@@ -234,6 +234,7 @@ static void do_fork()
 	pid_t pid = fork();
 	switch (pid) {
 	case -1: /* failed */
+		perror("fork");
 		exit(5);
 	case 0: /* child */
 		return;
@@ -241,6 +242,11 @@ static void do_fork()
 		waitpid(pid, &status, 0);
 		if (WIFEXITED(status))
 			exit(WEXITSTATUS(status));
+		if (WIFSIGNALED(status))
+			fprintf(stderr, "Child terminated by signal #%d\n",
+				WTERMSIG(status));
+		else
+			perror("waitpid");
 		exit(2);
 	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/libp11.git



More information about the pkg-opensc-commit mailing list