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,6 +52,7 @@ 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 */
if (!SIG_IS_TERM_OR_HUP(signo)) {
fprintf(stderr, fprintf(stderr,
_("Signal %d (%s) caught by %s (%s).\n"), _("Signal %d (%s) caught by %s (%s).\n"),
signo, signo,
@ -57,12 +60,14 @@ static void signal_handler(int signo){
myname, myname,
PACKAGE_VERSION 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:
if (!SIG_IS_TERM_OR_HUP(signo))
error_at_line(0, 0, __FILE__, __LINE__, "%s", _("please report this bug")); 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);