All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ondrej Oprala <ooprala@redhat.com>
To: "Pádraig Brady" <P@draigBrady.com>
Cc: util-linux@vger.kernel.org
Subject: Re: segfault message supressed with su -c
Date: Wed, 12 Sep 2012 12:22:50 +0200	[thread overview]
Message-ID: <5050627A.2030009@redhat.com> (raw)
In-Reply-To: <504F72A9.1090704@draigBrady.com>

[-- Attachment #1: Type: text/plain, Size: 347 bytes --]

> You'll need to key on WTERMSIG (status).
> "Segmentation fault" will not always be appropriate.
> You'll get a core just with Ctrl-\ (SIGQUIT) too for example.
> Something along the lines of:
>
> "%s (core dumped)", strsignal (WTERMSIG (status))
>
> cheers,
> Pádraig.
I've redone the patch to reflect your proposition :) .
Cheers,
   Ondrej.


[-- Attachment #2: DIFF --]
[-- Type: text/plain, Size: 1147 bytes --]

From 65e73591fce2fa961bf6de1cbc934f6aa7a22745 Mon Sep 17 00:00:00 2001
From: Ondrej Oprala <ooprala@redhat.com>
Date: Tue, 11 Sep 2012 16:39:17 +0200
Subject: [PATCH] su: add segmentation fault reporting of the child process
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Child processes that ended with segmentation fault previously
indicated this with return status only. The report is now more
verbose if core dump is allowed.

Improved-by: Pádraig Brady.
---
 login-utils/su-common.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/login-utils/su-common.c b/login-utils/su-common.c
index 23ad57d..2749303 100644
--- a/login-utils/su-common.c
+++ b/login-utils/su-common.c
@@ -300,7 +300,12 @@ create_watching_parent (void)
 	}
       if (pid != (pid_t)-1)
 	if (WIFSIGNALED (status))
-	  status = WTERMSIG (status) + 128;
+	  {
+	    status = WTERMSIG (status) + 128;
+	    if (WCOREDUMP (status))
+	      fprintf (stderr, _("%s (core dumped)\n"),
+                 strsignal (WTERMSIG (status)));
+	  }
 	else
 	  status = WEXITSTATUS (status);
       else
-- 
1.7.11.4


  reply	other threads:[~2012-09-12 10:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11 15:01 segfault message supressed with su -c Ondrej Oprala
2012-09-11 16:19 ` Voelker, Bernhard
2012-09-11 18:02   ` Pádraig Brady
2012-09-11 17:19 ` Pádraig Brady
2012-09-12 10:22   ` Ondrej Oprala [this message]
2012-09-21 10:39     ` Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5050627A.2030009@redhat.com \
    --to=ooprala@redhat.com \
    --cc=P@draigBrady.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.