summaryrefslogtreecommitdiffstats
path: root/login-utils/su-common.c
diff options
context:
space:
mode:
authorpcpa2014-09-27 21:04:16 +0200
committerKarel Zak2014-10-01 10:23:48 +0200
commit1d966345df6721dc1da257867a18a84f1d9f98d5 (patch)
tree2b02223d761d1ae0d51f202edb08a7aeca0040c8 /login-utils/su-common.c
parenttests: fix the ipcs test for shmall being too big to show (diff)
downloadkernel-qcow2-util-linux-1d966345df6721dc1da257867a18a84f1d9f98d5.tar.gz
kernel-qcow2-util-linux-1d966345df6721dc1da257867a18a84f1d9f98d5.tar.xz
kernel-qcow2-util-linux-1d966345df6721dc1da257867a18a84f1d9f98d5.zip
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>
Diffstat (limited to 'login-utils/su-common.c')
-rw-r--r--login-utils/su-common.c5
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);