Stop `pterm -ut-' leaving the unnecessary utmp helper as a zombie
[u/mdw/putty] / unix / pty.c
index 43923e9..7fe0dc7 100644 (file)
@@ -345,6 +345,7 @@ void pty_pre_init(void)
        close(pipefd[0]);
        pty_utmp_helper_pid = pid;
        pty_utmp_helper_pipe = pipefd[1];
+       signal(SIGCHLD, sigchld_handler);
     }
 #endif
 
@@ -451,6 +452,13 @@ static char *pty_init(char *host, int port, char **realhost, int nodelay)
            sprintf(term_env_var, "TERM=%s", cfg.termtype);
            putenv(term_env_var);
        }
+       /*
+        * SIGINT and SIGQUIT may have been set to ignored by our
+        * parent, particularly by things like sh -c 'pterm &' and
+        * some window managers. Reverse this for our child process.
+        */
+       signal(SIGINT, SIG_DFL);
+       signal(SIGQUIT, SIG_DFL);
        if (pty_argv)
            execvp(pty_argv[0], pty_argv);
        else {