aboutsummaryrefslogtreecommitdiff
path: root/lib/daemon.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-01-28 12:44:00 -0800
committerBen Pfaff <blp@nicira.com>2011-02-07 12:50:19 -0800
commita7ff9bd76312a7733168629d8e4e922d47b0ae46 (patch)
tree45d3de7951466e04ddddc63f108afa5de337aade /lib/daemon.c
parent8274ae959ac0b158c3e3206b3810af608fb93785 (diff)
ovs-vswitchd: Complete daemonization only after initial configuration.
Otherwise when we add support for saving and restoring configuration of internal devices around kernel module unload and reload, there's no easy way for the "restore" code to tell when all the interfaces should be set up and ready for configuration.
Diffstat (limited to 'lib/daemon.c')
-rw-r--r--lib/daemon.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/daemon.c b/lib/daemon.c
index 9db6c1f8..a8b3fae3 100644
--- a/lib/daemon.c
+++ b/lib/daemon.c
@@ -475,11 +475,14 @@ daemonize_start(void)
}
/* If daemonization is configured, then this function notifies the parent
- * process that the child process has completed startup successfully. */
+ * process that the child process has completed startup successfully.
+ *
+ * Calling this function more than once has no additional effect. */
void
daemonize_complete(void)
{
fork_notify_startup(daemonize_fd);
+ daemonize_fd = -1;
if (detach) {
setsid();
@@ -487,6 +490,7 @@ daemonize_complete(void)
ignore(chdir("/"));
}
close_standard_fds();
+ detach = false;
}
}