diff options
Diffstat (limited to 'shell/hush.c')
| -rw-r--r-- | shell/hush.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/shell/hush.c b/shell/hush.c index 4e6d50094..dcaeed0d7 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
| @@ -699,9 +699,18 @@ static const struct built_in_command bltins[] = { | |||
| 699 | BLTIN(NULL, NULL, NULL) | 699 | BLTIN(NULL, NULL, NULL) |
| 700 | }; | 700 | }; |
| 701 | 701 | ||
| 702 | /* Signals are grouped, we handle them in batches */ | ||
| 703 | static void set_misc_sighandler(void (*handler)(int)) | ||
| 704 | { | ||
| 705 | bb_signals(0 | ||
| 706 | + (1 << SIGINT) | ||
| 707 | + (1 << SIGQUIT) | ||
| 708 | + (1 << SIGTERM) | ||
| 709 | , handler); | ||
| 710 | } | ||
| 711 | |||
| 702 | #if ENABLE_HUSH_JOB | 712 | #if ENABLE_HUSH_JOB |
| 703 | 713 | ||
| 704 | /* Signals are grouped, we handle them in batches */ | ||
| 705 | static void set_fatal_sighandler(void (*handler)(int)) | 714 | static void set_fatal_sighandler(void (*handler)(int)) |
| 706 | { | 715 | { |
| 707 | bb_signals(0 | 716 | bb_signals(0 |
| @@ -725,14 +734,6 @@ static void set_jobctrl_sighandler(void (*handler)(int)) | |||
| 725 | + (1 << SIGTTOU) | 734 | + (1 << SIGTTOU) |
| 726 | , handler); | 735 | , handler); |
| 727 | } | 736 | } |
| 728 | static void set_misc_sighandler(void (*handler)(int)) | ||
| 729 | { | ||
| 730 | bb_signals(0 | ||
| 731 | + (1 << SIGINT) | ||
| 732 | + (1 << SIGQUIT) | ||
| 733 | + (1 << SIGTERM) | ||
| 734 | , handler); | ||
| 735 | } | ||
| 736 | /* SIGCHLD is special and handled separately */ | 737 | /* SIGCHLD is special and handled separately */ |
| 737 | 738 | ||
| 738 | static void set_every_sighandler(void (*handler)(int)) | 739 | static void set_every_sighandler(void (*handler)(int)) |
| @@ -815,7 +816,6 @@ static void hush_exit(int exitcode) | |||
| 815 | 816 | ||
| 816 | #define set_fatal_sighandler(handler) ((void)0) | 817 | #define set_fatal_sighandler(handler) ((void)0) |
| 817 | #define set_jobctrl_sighandler(handler) ((void)0) | 818 | #define set_jobctrl_sighandler(handler) ((void)0) |
| 818 | #define set_misc_sighandler(handler) ((void)0) | ||
| 819 | #define hush_exit(e) exit(e) | 819 | #define hush_exit(e) exit(e) |
| 820 | 820 | ||
| 821 | #endif /* JOB */ | 821 | #endif /* JOB */ |
| @@ -3907,8 +3907,10 @@ int hush_main(int argc, char **argv) | |||
| 3907 | /* give up */ | 3907 | /* give up */ |
| 3908 | interactive_fd = 0; | 3908 | interactive_fd = 0; |
| 3909 | } | 3909 | } |
| 3910 | if (interactive_fd) | 3910 | if (interactive_fd) { |
| 3911 | fcntl(interactive_fd, F_SETFD, FD_CLOEXEC); | 3911 | fcntl(interactive_fd, F_SETFD, FD_CLOEXEC); |
| 3912 | set_misc_sighandler(SIG_IGN); | ||
| 3913 | } | ||
| 3912 | } | 3914 | } |
| 3913 | #endif | 3915 | #endif |
| 3914 | 3916 | ||
