]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Ensure SA_SIGNAL test only signals itself.
authorDarren Tucker <dtucker@dtucker.net>
Fri, 8 May 2020 11:50:43 +0000 (21:50 +1000)
committerDarren Tucker <dtucker@dtucker.net>
Fri, 8 May 2020 11:50:43 +0000 (21:50 +1000)
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

configure.ac

index 3712d55dba2f761d956be951481958b1ea351d9c..003b235e516adbf59f833a8f4429304486325857 100644 (file)
@@ -2534,10 +2534,12 @@ static void sighandler(int sig) { }
        sa.sa_flags = SA_RESTART;
        (void)sigaction(SIGTERM, &sa, NULL);
        if ((pid = fork()) == 0) { /* child */
+               pid = getppid();
                sleep(1);
-               kill(getppid(), SIGTERM);
+               kill(pid, SIGTERM);
                sleep(1);
-               kill(getppid(), SIGKILL);
+               if (getppid() == pid) /* if parent did not exit, shoot it */
+                       kill(pid, SIGKILL);
                exit(0);
        } else { /* parent */
                r = select(0, NULL, NULL, NULL, NULL);