hush: remove special handling of SIGHUP
No binary (build failed)
—
(log yok)
| @@ -1830,6 +1830,8 @@ static void restore_G_args(save_arg_t *sv, char **argv) | |
| * SIGTERM (interactive): ignore | |
| * SIGHUP (interactive): | |
| * send SIGCONT to stopped jobs, send SIGHUP to all jobs and exit | |
| + | //HUP: we don't need to do this, kernel does this for us |
| + | //HUP: ("orphaned process group" handling according to POSIX) |
| * SIGTTIN, SIGTTOU, SIGTSTP (if job control is on): ignore | |
| * Note that ^Z is handled not by trapping SIGTSTP, but by seeing | |
| * that all pipe members are stopped. Try this in bash: | |
| @@ -1931,7 +1933,7 @@ enum { | |
| SPECIAL_INTERACTIVE_SIGS = 0 | |
| | (1 << SIGTERM) | |
| | (1 << SIGINT) | |
| - | | (1 << SIGHUP) |
| + | //HUP | (1 << SIGHUP) |
| , | |
| SPECIAL_JOBSTOP_SIGS = 0 | |
| #if ENABLE_HUSH_JOB | |
| @@ -2177,23 +2179,23 @@ static int check_and_run_traps(void) | |
| last_sig = sig; | |
| break; | |
| #if ENABLE_HUSH_JOB | |
| - | case SIGHUP: { |
| - | //TODO: why are we doing this? ash and dash don't do this, |
| - | //they have no handler for SIGHUP at all, |
| - | //they rely on kernel to send SIGHUP+SIGCONT to orphaned process groups |
| - | struct pipe *job; |
| - | debug_printf_exec("%s: sig:%d default SIGHUP handler\n", __func__, sig); |
| - | /* bash is observed to signal whole process groups, |
| - | * not individual processes */ |
| - | for (job = G.job_list; job; job = job->next) { |
| - | if (job->pgrp <= 0) |
| - | continue; |
| - | debug_printf_exec("HUPing pgrp %d\n", job->pgrp); |
| - | if (kill(- job->pgrp, SIGHUP) == 0) |
| - | kill(- job->pgrp, SIGCONT); |
| - | } |
| - | sigexit(SIGHUP); |
| - | } |
| + | //HUP case SIGHUP: { |
| + | //HUP//TODO: why are we doing this? ash and dash don't do this, |
| + | //HUP//they have no handler for SIGHUP at all, |
| + | //HUP//they rely on kernel to send SIGHUP+SIGCONT to orphaned process groups |
| + | //HUP struct pipe *job; |
| + | //HUP debug_printf_exec("%s: sig:%d default SIGHUP handler\n", __func__, sig); |
| + | //HUP /* bash is observed to signal whole process groups, |
| + | //HUP * not individual processes */ |
| + | //HUP for (job = G.job_list; job; job = job->next) { |
| + | //HUP if (job->pgrp <= 0) |
| + | //HUP continue; |
| + | //HUP debug_printf_exec("HUPing pgrp %d\n", job->pgrp); |
| + | //HUP if (kill(- job->pgrp, SIGHUP) == 0) |
| + | //HUP kill(- job->pgrp, SIGCONT); |
| + | //HUP } |
| + | //HUP sigexit(SIGHUP); |
| + | //HUP } |
| #endif | |
| #if ENABLE_HUSH_FAST | |
| case SIGCHLD: | |