diff options
author | Arne Juul <arnej@yahooinc.com> | 2023-01-13 13:14:40 +0000 |
---|---|---|
committer | Arne Juul <arnej@yahooinc.com> | 2023-01-13 13:14:40 +0000 |
commit | 1a7839b48ecc3d87f71123756653969c2f9bfa5f (patch) | |
tree | fc6c26cbf5a949c109cddca6c1861b110e47d08e /vespalog | |
parent | 9e4fc3e194be70c641a8acc09dbe08998ff9c86a (diff) |
set close-on-exec flag on duplicated file descriptor
Diffstat (limited to 'vespalog')
-rw-r--r-- | vespalog/src/vespa/log/log-target-fd.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/vespalog/src/vespa/log/log-target-fd.cpp b/vespalog/src/vespa/log/log-target-fd.cpp index a740d3fef06..bb7590a9908 100644 --- a/vespalog/src/vespa/log/log-target-fd.cpp +++ b/vespalog/src/vespa/log/log-target-fd.cpp @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <sys/types.h> #include <unistd.h> +#include <fcntl.h> #include <cstring> #include <cstdlib> @@ -22,6 +23,7 @@ LogTargetFd::LogTargetFd(int fd_spec, const char *target) if (isatty(_fd) == 1) { _istty = true; } + fcntl(_fd, F_SETFD, FD_CLOEXEC); } LogTargetFd::~LogTargetFd() |