Re: [ovs-dev] [PATCH 02/13] daemon-unix: With --monitor, only close standard fds if --detach also used.

2017-10-06 Thread Russell Bryant
On Fri, Oct 6, 2017 at 8:44 PM, Ben Pfaff  wrote:
> 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 

Acked-by: Russell Bryant 

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


[ovs-dev] [PATCH 02/13] daemon-unix: With --monitor, only close standard fds if --detach also used.

2017-10-06 Thread Ben Pfaff
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 
---
 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