This fixes a problem in ofp-discover, where it would daemonize itself
after setting an IP address on one of its interfaces. The daemonize
function would call fatal_signal_fork() then exit(0), which would in turn
cause the netdev code to disable the interface and thereby remove the IP
address.
The bug that this fixes was introduced in commit
3cc1ae6a3, "Add ability
to run fatal signal hooks upon normal termination too."
/* Signal mask saved by outermost signal blocker. */
static sigset_t saved_signal_mask;
+/* Disabled by fatal_signal_fork()? */
+static bool disabled;
+
static void call_sigprocmask(int how, sigset_t* new_set, sigset_t* old_set);
static void atexit_handler(void);
static void call_hooks(int sig_nr);
static void
atexit_handler(void)
{
- call_hooks(0);
+ if (!disabled) {
+ call_hooks(0);
+ }
}
static void
\f
static char **files;
static size_t n_files, max_files;
-static bool disabled;
static void unlink_files(void *aux);
static void do_unlink_files(void);
static void
do_unlink_files(void)
{
- if (!disabled) {
- size_t i;
+ size_t i;
- for (i = 0; i < n_files; i++) {
- unlink(files[i]);
- }
+ for (i = 0; i < n_files; i++) {
+ unlink(files[i]);
}
}
\f