summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-05-25 21:50:55 +0000
committerDenis Vlasenko2008-05-25 21:50:55 +0000
commit4830fc565acd064e4ae033a6573a432c8b3857b9 (patch)
tree88666b684b036ba7f42f9788deb09bd6e098ddbc
parentaf6cca50afbf8b6c6cbdbc898eeacb8e23d13a34 (diff)
downloadbusybox-4830fc565acd064e4ae033a6573a432c8b3857b9.zip
busybox-4830fc565acd064e4ae033a6573a432c8b3857b9.tar.gz
hush: make it ignore SIGINT etc in a config wich has no job control
-rw-r--r--shell/hush.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 26d113b..9e574c9 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -698,9 +698,18 @@ static const struct built_in_command bltins[] = {
BLTIN(NULL, NULL, NULL)
};
+/* Signals are grouped, we handle them in batches */
+static void set_misc_sighandler(void (*handler)(int))
+{
+ bb_signals(0
+ + (1 << SIGINT)
+ + (1 << SIGQUIT)
+ + (1 << SIGTERM)
+ , handler);
+}
+
#if ENABLE_HUSH_JOB
-/* Signals are grouped, we handle them in batches */
static void set_fatal_sighandler(void (*handler)(int))
{
bb_signals(0
@@ -724,14 +733,6 @@ static void set_jobctrl_sighandler(void (*handler)(int))
+ (1 << SIGTTOU)
, handler);
}
-static void set_misc_sighandler(void (*handler)(int))
-{
- bb_signals(0
- + (1 << SIGINT)
- + (1 << SIGQUIT)
- + (1 << SIGTERM)
- , handler);
-}
/* SIGCHLD is special and handled separately */
static void set_every_sighandler(void (*handler)(int))
@@ -814,7 +815,6 @@ static void hush_exit(int exitcode)
#define set_fatal_sighandler(handler) ((void)0)
#define set_jobctrl_sighandler(handler) ((void)0)
-#define set_misc_sighandler(handler) ((void)0)
#define hush_exit(e) exit(e)
#endif /* JOB */
@@ -3906,8 +3906,10 @@ int hush_main(int argc, char **argv)
/* give up */
interactive_fd = 0;
}
- if (interactive_fd)
+ if (interactive_fd) {
fcntl(interactive_fd, F_SETFD, FD_CLOEXEC);
+ set_misc_sighandler(SIG_IGN);
+ }
}
#endif