diff options
author | pcpa <paulo.cesar.pereira.de.andrade@gmail.com> | 2014-09-27 16:04:16 -0300 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2014-10-24 10:24:29 +0200 |
commit | c29b5d64f92f3c9b25c842006b6bff56e67b1975 (patch) | |
tree | 87db404588eb98016a687c569ad2bbc7b0a09614 | |
parent | cd23bfb4d3e5de352524f30c627791fa69200d2d (diff) | |
download | util-linux-c29b5d64f92f3c9b25c842006b6bff56e67b1975.tar.gz |
su: print proper core dump message when killed
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>
-rw-r--r-- | login-utils/su-common.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/login-utils/su-common.c b/login-utils/su-common.c index db7282621..eb3b844be 100644 --- a/login-utils/su-common.c +++ b/login-utils/su-common.c @@ -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); |