]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: don't close stdio when running foreground
authorDavid Lamparter <equinox@opensourcerouting.org>
Fri, 11 Aug 2017 13:43:28 +0000 (15:43 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Fri, 11 Aug 2017 13:45:56 +0000 (15:45 +0200)
c9c8d0d ("lib: close stdin/out/err in non-terminal case") overshot its
goal and closes stdin/stdout/stderr even when a daemon is running in
foreground.  That means stdout logging & exit memory reporting are both
broken.

Reported-by: Lou Berger <lberger@labn.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/libfrr.c

index e5573da90013304ecd1a359eb27ddd52bc6d3cf9..a5c87e6edc6d6d5f003ed2731108ca9491f542f0 100644 (file)
@@ -812,7 +812,7 @@ void frr_run(struct thread_master *master)
                        thread_add_read(master, frr_daemon_ctl, NULL,
                                        daemon_ctl_sock, &daemon_ctl_thread);
                }
-       } else {
+       } else if (di->daemon_mode) {
                int nullfd = open("/dev/null", O_RDONLY | O_NOCTTY);
                dup2(nullfd, 0);
                dup2(nullfd, 1);