summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2020-05-08 21:50:43 +1000
committerDarren Tucker <dtucker@dtucker.net>2020-05-08 21:50:43 +1000
commit4fa9e048c2af26beb7dc2ee9479ff3323e92a7b5 (patch)
treec8ae4e29d16258eab9b866454ff6f0cbec01220d
parentdc2da29aae76e170d22f38bb36f1f5d1edd5ec2b (diff)
Ensure SA_SIGNAL test only signals itself.
When the test's child signals its parent and it exits the result of getppid changes. On Ubuntu 20.04 this results in the ppid being that of the GDM session, causing it to exit. Analysis and testing from pedro at ambientworks.net
-rw-r--r--configure.ac6
1 files changed, 4 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 3712d55db..003b235e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2534,10 +2534,12 @@ static void sighandler(int sig) { }
2534 sa.sa_flags = SA_RESTART; 2534 sa.sa_flags = SA_RESTART;
2535 (void)sigaction(SIGTERM, &sa, NULL); 2535 (void)sigaction(SIGTERM, &sa, NULL);
2536 if ((pid = fork()) == 0) { /* child */ 2536 if ((pid = fork()) == 0) { /* child */
2537 pid = getppid();
2537 sleep(1); 2538 sleep(1);
2538 kill(getppid(), SIGTERM); 2539 kill(pid, SIGTERM);
2539 sleep(1); 2540 sleep(1);
2540 kill(getppid(), SIGKILL); 2541 if (getppid() == pid) /* if parent did not exit, shoot it */
2542 kill(pid, SIGKILL);
2541 exit(0); 2543 exit(0);
2542 } else { /* parent */ 2544 } else { /* parent */
2543 r = select(0, NULL, NULL, NULL, NULL); 2545 r = select(0, NULL, NULL, NULL, NULL);