diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2016-11-08 20:46:05 +0100 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2016-11-09 13:40:05 +0100 |
| commit | 2da59394ec858ae5aecf2b26ab8d9fefdae17bb8 (patch) | |
| tree | 720795e72480f81c7f1cbabe1445bbd4ba8acc1c /lib/pid_output.c | |
| parent | 73ea75daa522a43ad0be9bff1f26a98bc2e105b0 (diff) | |
lib: add and use set_cloexec()
watchquagga is already leaking an open file descriptor on its pid file
on fork+exec() invocations; next up is adding vtysh support with even
more fds. Mark things CLOEXEC before going there.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/pid_output.c')
| -rw-r--r-- | lib/pid_output.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/pid_output.c b/lib/pid_output.c index 5261babc6d..de4c2fba99 100644 --- a/lib/pid_output.c +++ b/lib/pid_output.c @@ -24,6 +24,7 @@ #include <fcntl.h> #include <log.h> #include "version.h" +#include "network.h" #define PIDFILE_MASK 0644 #ifndef HAVE_FCNTL @@ -84,6 +85,8 @@ pid_output (const char *path) umask(oldumask); memset (&lock, 0, sizeof(lock)); + set_cloexec(fd); + lock.l_type = F_WRLCK; lock.l_whence = SEEK_SET; |
