Blame SOURCES/procps-ng-3.3.15-display-sig-unsafe.patch
|
|
7bdeda |
diff -up ./ps/display.c.ori ./ps/display.c
|
|
|
7bdeda |
--- ./ps/display.c.ori 2018-05-18 23:32:21.998979977 +0200
|
|
|
7bdeda |
+++ ./ps/display.c 2022-11-24 15:11:26.678314866 +0100
|
|
|
7bdeda |
@@ -44,26 +44,31 @@
|
|
|
7bdeda |
#define SIGCHLD SIGCLD
|
|
|
7bdeda |
#endif
|
|
|
7bdeda |
|
|
|
7bdeda |
+#define SIG_IS_TERM_OR_HUP(signo) (((signo) == SIGTERM) || (signo) == SIGHUP)
|
|
|
7bdeda |
+
|
|
|
7bdeda |
char *myname;
|
|
|
7bdeda |
|
|
|
7bdeda |
/* just reports a crash */
|
|
|
7bdeda |
static void signal_handler(int signo){
|
|
|
7bdeda |
if(signo==SIGPIPE) _exit(0); /* "ps | head" will cause this */
|
|
|
7bdeda |
/* fprintf() is not reentrant, but we _exit() anyway */
|
|
|
7bdeda |
- fprintf(stderr,
|
|
|
7bdeda |
- _("Signal %d (%s) caught by %s (%s).\n"),
|
|
|
7bdeda |
- signo,
|
|
|
7bdeda |
- signal_number_to_name(signo),
|
|
|
7bdeda |
- myname,
|
|
|
7bdeda |
- PACKAGE_VERSION
|
|
|
7bdeda |
- );
|
|
|
7bdeda |
+ if (!SIG_IS_TERM_OR_HUP(signo)) {
|
|
|
7bdeda |
+ fprintf(stderr,
|
|
|
7bdeda |
+ _("Signal %d (%s) caught by %s (%s).\n"),
|
|
|
7bdeda |
+ signo,
|
|
|
7bdeda |
+ signal_number_to_name(signo),
|
|
|
7bdeda |
+ myname,
|
|
|
7bdeda |
+ PACKAGE_VERSION
|
|
|
7bdeda |
+ );
|
|
|
7bdeda |
+ }
|
|
|
7bdeda |
switch (signo) {
|
|
|
7bdeda |
case SIGHUP:
|
|
|
7bdeda |
case SIGUSR1:
|
|
|
7bdeda |
case SIGUSR2:
|
|
|
7bdeda |
exit(EXIT_FAILURE);
|
|
|
7bdeda |
default:
|
|
|
7bdeda |
- error_at_line(0, 0, __FILE__, __LINE__, "%s", _("please report this bug"));
|
|
|
7bdeda |
+ if (!SIG_IS_TERM_OR_HUP(signo))
|
|
|
7bdeda |
+ error_at_line(0, 0, __FILE__, __LINE__, "%s", _("please report this bug"));
|
|
|
7bdeda |
signal(signo, SIG_DFL); /* allow core file creation */
|
|
|
7bdeda |
kill(getpid(), signo);
|
|
|
7bdeda |
_exit(EXIT_FAILURE);
|