* kill itself. For example, this can happen with some versions of
* reboot that call kill(-1, SIGTERM) to kill all other processes.
*/
- if (info != NULL && info->si_code == SI_USER) {
+ if (USER_SIGNALED(info)) {
pid_t si_pgrp = getpgid(info->si_pid);
if (si_pgrp != (pid_t)-1) {
if (si_pgrp == ppgrp || si_pgrp == cmnd_pid)
* often trap ^Z and send SIGTSTP to their own pgrp, so we don't
* want to send an extra SIGTSTP.
*/
- if (info == NULL || info->si_code != SI_USER)
+ if (!USER_SIGNALED(info))
return;
if ((si_pgrp = getpgid(info->si_pid)) != (pid_t)-1) {
if (si_pgrp == ppgrp || si_pgrp == cmnd_pid)
* itself. This can happen with, e.g., BSD-derived versions of
* reboot that call kill(-1, SIGTERM) to kill all other processes.
*/
- if (info != NULL && info->si_code == SI_USER) {
+ if (USER_SIGNALED(info)) {
pid_t si_pgrp = getpgid(info->si_pid);
if (si_pgrp != (pid_t)-1) {
if (si_pgrp == cmnd_pgrp)
# define MSG_WAITALL 0
#endif
+/*
+ * Some older systems support siginfo but predate SI_USER.
+ */
+#ifdef SA_SIGINFO
+# ifdef SI_USER
+# define USER_SIGNALED(_info) ((_info) != NULL && (_info)->si_code == SI_USER)
+# else
+# define USER_SIGNALED(_info) ((_info) != NULL && (_info)->si_code <= 0)
+# endif
+#endif
+
/*
* Special values to indicate whether continuing in foreground or background.
*/