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