aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-05-25 21:50:55 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-05-25 21:50:55 +0000
commit4830fc565acd064e4ae033a6573a432c8b3857b9 (patch)
tree88666b684b036ba7f42f9788deb09bd6e098ddbc /shell
parentaf6cca50afbf8b6c6cbdbc898eeacb8e23d13a34 (diff)
downloadbusybox-w32-4830fc565acd064e4ae033a6573a432c8b3857b9.tar.gz
busybox-w32-4830fc565acd064e4ae033a6573a432c8b3857b9.tar.bz2
busybox-w32-4830fc565acd064e4ae033a6573a432c8b3857b9.zip
hush: make it ignore SIGINT etc in a config wich has no job control
Diffstat (limited to 'shell')
-rw-r--r--shell/hush.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 26d113b17..9e574c90c 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -698,9 +698,18 @@ static const struct built_in_command bltins[] = {
698 BLTIN(NULL, NULL, NULL) 698 BLTIN(NULL, NULL, NULL)
699}; 699};
700 700
701/* Signals are grouped, we handle them in batches */
702static void set_misc_sighandler(void (*handler)(int))
703{
704 bb_signals(0
705 + (1 << SIGINT)
706 + (1 << SIGQUIT)
707 + (1 << SIGTERM)
708 , handler);
709}
710
701#if ENABLE_HUSH_JOB 711#if ENABLE_HUSH_JOB
702 712
703/* Signals are grouped, we handle them in batches */
704static void set_fatal_sighandler(void (*handler)(int)) 713static void set_fatal_sighandler(void (*handler)(int))
705{ 714{
706 bb_signals(0 715 bb_signals(0
@@ -724,14 +733,6 @@ static void set_jobctrl_sighandler(void (*handler)(int))
724 + (1 << SIGTTOU) 733 + (1 << SIGTTOU)
725 , handler); 734 , handler);
726} 735}
727static void set_misc_sighandler(void (*handler)(int))
728{
729 bb_signals(0
730 + (1 << SIGINT)
731 + (1 << SIGQUIT)
732 + (1 << SIGTERM)
733 , handler);
734}
735/* SIGCHLD is special and handled separately */ 736/* SIGCHLD is special and handled separately */
736 737
737static void set_every_sighandler(void (*handler)(int)) 738static void set_every_sighandler(void (*handler)(int))
@@ -814,7 +815,6 @@ static void hush_exit(int exitcode)
814 815
815#define set_fatal_sighandler(handler) ((void)0) 816#define set_fatal_sighandler(handler) ((void)0)
816#define set_jobctrl_sighandler(handler) ((void)0) 817#define set_jobctrl_sighandler(handler) ((void)0)
817#define set_misc_sighandler(handler) ((void)0)
818#define hush_exit(e) exit(e) 818#define hush_exit(e) exit(e)
819 819
820#endif /* JOB */ 820#endif /* JOB */
@@ -3906,8 +3906,10 @@ int hush_main(int argc, char **argv)
3906 /* give up */ 3906 /* give up */
3907 interactive_fd = 0; 3907 interactive_fd = 0;
3908 } 3908 }
3909 if (interactive_fd) 3909 if (interactive_fd) {
3910 fcntl(interactive_fd, F_SETFD, FD_CLOEXEC); 3910 fcntl(interactive_fd, F_SETFD, FD_CLOEXEC);
3911 set_misc_sighandler(SIG_IGN);
3912 }
3911 } 3913 }
3912#endif 3914#endif
3913 3915