Merge branch 'time-river/procps-newlib' into newlib

References:
 procps-ng/procps!155
 procps-ng/procps#236
This commit is contained in:
Craig Small 2022-04-26 20:25:00 +10:00
commit 581ed4bcab

View File

@ -39,6 +39,8 @@
#define SIGCHLD SIGCLD
#endif
#define SIG_IS_TERM_OR_HUP(signo) (((signo) == SIGTERM) || (signo) == SIGHUP)
char *myname;
long Hertz;
@ -50,6 +52,7 @@ static void signal_handler(int signo){
sigprocmask(SIG_BLOCK, &ss, NULL);
if(signo==SIGPIPE) _exit(0); /* "ps | head" will cause this */
/* fprintf() is not reentrant, but we _exit() anyway */
if (!SIG_IS_TERM_OR_HUP(signo)) {
fprintf(stderr,
_("Signal %d (%s) caught by %s (%s).\n"),
signo,
@ -57,12 +60,14 @@ static void signal_handler(int signo){
myname,
PACKAGE_VERSION
);
}
switch (signo) {
case SIGHUP:
case SIGUSR1:
case SIGUSR2:
exit(EXIT_FAILURE);
default:
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 */
sigemptyset(&ss);