diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2017-08-03 03:37:37 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2017-08-03 03:37:37 +0200 |
| commit | c9c8d0d189ce58e3dd6611a1cf6e566806f137cc (patch) | |
| tree | 05b407c3d3dc8d47a185e20204766ae0abb88702 /lib | |
| parent | 27e295b591bad314abe696f0bac06a83af66577c (diff) | |
lib: close stdin/out/err in non-terminal case
Oops, forgot this path... in the --terminal case, stdio is closed when
the user ends the terminal session, but without terminal it was left
open.
(This caused a ssh session hang in the CentOS6 CI because the file
descriptors were still open, so ssh would keep the session alive...)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libfrr.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c index 55d7784752..aa21a143ba 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -688,8 +688,15 @@ void frr_run(struct thread_master *master) thread_add_read(master, frr_daemon_ctl, NULL, daemon_ctl_sock, &daemon_ctl_thread); } - } else if (daemon_ctl_sock != -1) { - close(daemon_ctl_sock); + } else { + int nullfd = open("/dev/null", O_RDONLY | O_NOCTTY); + dup2(nullfd, 0); + dup2(nullfd, 1); + dup2(nullfd, 2); + close(nullfd); + + if (daemon_ctl_sock != -1) + close(daemon_ctl_sock); daemon_ctl_sock = -1; } |
