From c1f10d11bc7fbab3af54a2b16e6db721b7e44f5c Mon Sep 17 00:00:00 2001 From: Jaromir Capik Date: Wed, 12 Dec 2012 15:37:42 +0100 Subject: [PATCH] Allow core file generation by ps command (rhbz#871825, rhbz#512857) Since the ps command handles signals with it's own handler, it doesn't create core files when something wrong happens. The attached patch restores the ps command ability to create core files by calling the default handler once we print our custom message. The original RH's workaround masked SIGABRT and SIGSEGV signals and that would conflict with the original intention of the custom signal handler and also with the filtering patch I sent in my previous email. Moreover, this solution generates core for all relevant signals (SIGFPE, etc.). Bug-Redhat: http://bugzilla.redhat.com/871825 Bug-Redhat: http://bugzilla.redhat.com/512857 Reference: http://www.freelists.org/post/procps/PATCH-Allow-core-file-generation-by-ps-command-rhbz871825-rhbz512857 Signed-off-by: Craig Small --- ps/display.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ps/display.c b/ps/display.c index 85c50a10..b1f98bdc 100644 --- a/ps/display.c +++ b/ps/display.c @@ -62,7 +62,9 @@ static void signal_handler(int signo){ case SIGUSR2: exit(EXIT_FAILURE); default: - catastrophic_failure(__FILE__, __LINE__, _("please report this bug")); + error_at_line(0, 0, __FILE__, __LINE__, "%s", _("please report this bug")); + signal(signo, SIG_DFL); /* allow core file creation */ + kill(getpid(), signo); } } -- 2.40.0