summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-11-11 09:33:24 +0000
committerDenis Vlasenko2008-11-11 09:33:24 +0000
commit3b35fbb6323adadf7108e1d32fc4d93b4d89e9c4 (patch)
tree31ed116e9873ed135b713851b8d97780617d488b
parent9f2f808b0dd531840b906e6dd09550a626c32bf1 (diff)
downloadbusybox-3b35fbb6323adadf7108e1d32fc4d93b4d89e9c4.zip
busybox-3b35fbb6323adadf7108e1d32fc4d93b4d89e9c4.tar.gz
runsvdir: straighten some convoluted code. logic is unchanged
-rw-r--r--runit/runsvdir.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/runit/runsvdir.c b/runit/runsvdir.c
index 9d560e0..f673304 100644
--- a/runit/runsvdir.c
+++ b/runit/runsvdir.c
@@ -377,19 +377,17 @@ int runsvdir_main(int argc UNUSED_PARAM, char **argv)
}
}
- switch (bb_got_signal) {
- case SIGHUP:
+ if (bb_got_signal == SIGHUP) {
for (i = 0; i < svnum; i++)
if (sv[i].pid)
kill(sv[i].pid, SIGTERM);
- /* Fall through */
- default: /* SIGTERM (or SIGUSRn if we are init) */
- /* Exit unless we are init */
- if (getpid() == 1)
- break;
- return (SIGHUP == bb_got_signal) ? 111 : EXIT_SUCCESS;
}
+ /* SIGHUP or SIGTERM (or SIGUSRn if we are init) */
+ /* Exit unless we are init */
+ if (getpid() != 1)
+ return (SIGHUP == bb_got_signal) ? 111 : EXIT_SUCCESS;
+ /* init continues to monitor services forever */
bb_got_signal = 0;
} /* for (;;) */
}