diff options
-rw-r--r-- | runit/runsv.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/runit/runsv.c b/runit/runsv.c index 7fad563f5..a4b8af494 100644 --- a/runit/runsv.c +++ b/runit/runsv.c | |||
@@ -149,20 +149,17 @@ static void warn_cannot(const char *m) | |||
149 | warn2_cannot(m, ""); | 149 | warn2_cannot(m, ""); |
150 | } | 150 | } |
151 | 151 | ||
152 | /* SIGCHLD/TERM handlers are reentrancy-safe because they are unmasked | 152 | /* SIGCHLD/TERM handler is reentrancy-safe because they are unmasked |
153 | * only over poll() call, not over memory allocations | 153 | * only over poll() call, not over memory allocations |
154 | * or printouts. Do not need to save/restore errno either, | 154 | * or printouts. Do not need to save/restore errno either, |
155 | * as poll() error is not checked there. | 155 | * as poll() error is not checked there. |
156 | */ | 156 | */ |
157 | static void s_child(int sig_no UNUSED_PARAM) | 157 | static void s_chld_term(int sig_no) |
158 | { | 158 | { |
159 | if (sig_no == SIGTERM) | ||
160 | sigterm = 1; | ||
159 | write(selfpipe.wr, "", 1); | 161 | write(selfpipe.wr, "", 1); |
160 | } | 162 | } |
161 | static void s_term(int sig_no UNUSED_PARAM) | ||
162 | { | ||
163 | sigterm = 1; | ||
164 | write(selfpipe.wr, "", 1); /* XXX */ | ||
165 | } | ||
166 | 163 | ||
167 | static int open_trunc_or_warn(const char *name) | 164 | static int open_trunc_or_warn(const char *name) |
168 | { | 165 | { |
@@ -523,8 +520,10 @@ int runsv_main(int argc UNUSED_PARAM, char **argv) | |||
523 | * (poll() wouldn't restart regardless of that flag), | 520 | * (poll() wouldn't restart regardless of that flag), |
524 | * we just follow what runit-2.1.2 does: | 521 | * we just follow what runit-2.1.2 does: |
525 | */ | 522 | */ |
526 | bb_signals_norestart(1 << SIGCHLD, s_child); | 523 | bb_signals_norestart(0 |
527 | bb_signals_norestart(1 << SIGTERM, s_term); | 524 | + (1 << SIGCHLD) |
525 | + (1 << SIGTERM) | ||
526 | , s_chld_term); | ||
528 | 527 | ||
529 | xchdir(dir); | 528 | xchdir(dir); |
530 | /* bss: svd[0].pid = 0; */ | 529 | /* bss: svd[0].pid = 0; */ |