[PATCH] su: print proper core dump message when killed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 login-utils/su-common.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/login-utils/su-common.c b/login-utils/su-common.c
index db72826..eb3b844 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);
-- 
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux