That allows child processes to safely use the standard fatal() calls
etc.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
sigset_t done;
struct sigaction sa;
+ clear_phase_hooks(PHASE_SHUTDOWN);
+ /* Prevents calls to fatal() etc. in the child from running off
+ and doing a lot of unhelpful things */
+
sigemptyset(&done);
for (n=sigs; n; n=n->next)
if (!sigismember(&done,n->signum)) {
extern void enter_phase(uint32_t new_phase);
void phase_hooks_init(void); /* for main() only */
+void clear_phase_hooks(uint32_t phase); /* for afterfork() */
/* Some features (like netlink 'soft' routes) require that secnet
retain root privileges. They should indicate that here when
LIST_INIT(&hooks[i]);
}
+void clear_phase_hooks(uint32_t phase)
+{
+ struct phase_hook *h, *htmp;
+ LIST_FOREACH_SAFE(h, &hooks[phase], entry, htmp)
+ free(h);
+ LIST_INIT(&hooks[phase]);
+}
+
bool_t add_hook(uint32_t phase, hook_fn *fn, void *state)
{
struct phase_hook *h;