From: pcpa Date: Sat, 27 Sep 2014 19:04:16 +0000 (-0300) Subject: su: print proper core dump message when killed X-Git-Tag: v2.26-rc1~431 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1d966345df6721dc1da257867a18a84f1d9f98d5;p=thirdparty%2Futil-linux.git 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 --- diff --git a/login-utils/su-common.c b/login-utils/su-common.c index db72826214..eb3b844be0 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);