]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
su: print proper core dump message when killed
authorpcpa <paulo.cesar.pereira.de.andrade@gmail.com>
Sat, 27 Sep 2014 19:04:16 +0000 (16:04 -0300)
committerKarel Zak <kzak@redhat.com>
Wed, 1 Oct 2014 08:23:48 +0000 (10:23 +0200)
An example is, in one terminal "sudo su -; echo $$", and in
another terminal, "kill -9  $PID" (the pid of the su -). It
should not print "(core dumped)", unless the kill signal
specified so, e.g. kill -7 or kill -11.

Signed-off-by: pcpa <paulo.cesar.pereira.de.andrade@gmail.com>
login-utils/su-common.c

index db728262143dc78cc014eda33107cc047b7415fc..eb3b844be07fdefb6e95bfdf707675822cd83e29 100644 (file)
@@ -363,10 +363,9 @@ create_watching_parent (void)
         {
           if (WIFSIGNALED (status))
             {
+              fprintf (stderr, "%s%s\n", strsignal (WTERMSIG (status)),
+                       WCOREDUMP (status) ? _(" (core dumped)") : "");
               status = WTERMSIG (status) + 128;
-              if (WCOREDUMP (status))
-                fprintf (stderr, _("%s (core dumped)\n"),
-                   strsignal (WTERMSIG (status)));
             }
           else
             status = WEXITSTATUS (status);