Daemons generally should close the standard fds because they don't want to
hold open an SSH session, etc. that is attached to a tty.  But --monitor
without --detach does not daemonize, so do not close fds in that case.

Signed-off-by: Ben Pfaff <b...@ovn.org>
---
 lib/daemon-unix.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/daemon-unix.c b/lib/daemon-unix.c
index 839114f3edf3..967a2843251f 100644
--- a/lib/daemon-unix.c
+++ b/lib/daemon-unix.c
@@ -472,7 +472,9 @@ daemonize_start(bool access_datapath)
         if (daemon_pid > 0) {
             /* Running in monitor process. */
             fork_notify_startup(saved_daemonize_fd);
-            close_standard_fds();
+            if (detach) {
+                close_standard_fds();
+            }
             monitor_daemon(daemon_pid);
         }
         /* Running in daemon process. */
-- 
2.10.2

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to