From: Ben Pfaff Date: Wed, 3 Sep 2008 17:10:39 +0000 (-0700) Subject: Also disable atexit hooks in fatal_signal_fork(). X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=bb93ad418c771e7ba1a4256bf59cbe510102d1bd;hp=123301f8b57df7e539478c607d52d21b55e023c0;p=sliver-openvswitch.git Also disable atexit hooks in fatal_signal_fork(). 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." --- diff --git a/lib/fatal-signal.c b/lib/fatal-signal.c index 95f54ff9c..99b9d5e21 100644 --- a/lib/fatal-signal.c +++ b/lib/fatal-signal.c @@ -64,6 +64,9 @@ static int block_level = 0; /* 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); @@ -156,7 +159,9 @@ fatal_signal_handler(int sig_nr) static void atexit_handler(void) { - call_hooks(0); + if (!disabled) { + call_hooks(0); + } } static void @@ -179,7 +184,6 @@ call_hooks(int sig_nr) 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); @@ -231,12 +235,10 @@ unlink_files(void *aux UNUSED) 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]); } }