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