public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] su: print proper core dump message when killed
@ 2014-09-27 19:04 pcpa
  2014-10-01  8:32 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: pcpa @ 2014-09-27 19:04 UTC (permalink / raw)
  To: util-linux; +Cc: pcpa

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 | 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] su: print proper core dump message when killed
  2014-09-27 19:04 [PATCH] su: print proper core dump message when killed pcpa
@ 2014-10-01  8:32 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2014-10-01  8:32 UTC (permalink / raw)
  To: pcpa; +Cc: util-linux

On Sat, Sep 27, 2014 at 04:04:16PM -0300, pcpa wrote:
>  login-utils/su-common.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-01  8:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-27 19:04 [PATCH] su: print proper core dump message when killed pcpa
2014-10-01  8:32 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox