]> granicus.if.org Git - sudo/commitdiff
If the command terminated due to a signal, sudo will send that same
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 27 Apr 2017 16:34:30 +0000 (10:34 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 27 Apr 2017 16:34:30 +0000 (10:34 -0600)
signal to itself so the parent shell knows the command died from
a signal.  However, we don't want sudo itself to dump core.

src/sudo.c

index 1dd0409cbc926d523c4c55427053c24725c20b44..0af1433f8d4f2672ffd7373f8898c5686edd3c68 100644 (file)
@@ -316,9 +316,17 @@ main(int argc, char *argv[], char *envp[])
            sudo_fatalx(U_("unexpected sudo mode 0x%x"), sudo_mode);
     }
 
+    /*
+     * If the command was terminated by a signal, sudo needs to terminated
+     * the same way.  Otherwise, the shell may ignore a keyboard-generated
+     * signal.  However, we want to avoid having sudo dump core itself.
+     */
     if (WIFSIGNALED(status)) {
        sigaction_t sa;
 
+       if (WCOREDUMP(status))
+           disable_coredumps();
+
        memset(&sa, 0, sizeof(sa));
        sigemptyset(&sa.sa_mask);
        sa.sa_handler = SIG_DFL;