From 4dec12fcfc95714d325985c1684fc984e36c6d2b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 3 Mar 2015 22:20:51 +0100 Subject: [PATCH] system/FileDescriptor: move O_NOCTTY|O_CLOEXEC to Open() --- src/system/FileDescriptor.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/system/FileDescriptor.cxx b/src/system/FileDescriptor.cxx index b8b5a4fdf..dd516a703 100644 --- a/src/system/FileDescriptor.cxx +++ b/src/system/FileDescriptor.cxx @@ -60,14 +60,14 @@ bool FileDescriptor::Open(const char *pathname, int flags) { - fd = ::open(pathname, flags); + fd = ::open(pathname, flags | O_NOCTTY | O_CLOEXEC); return IsDefined(); } bool FileDescriptor::OpenReadOnly(const char *pathname) { - return Open(pathname, O_RDONLY | O_NOCTTY | O_CLOEXEC); + return Open(pathname, O_RDONLY); } #ifndef WIN32 @@ -75,7 +75,7 @@ FileDescriptor::OpenReadOnly(const char *pathname) bool FileDescriptor::OpenNonBlocking(const char *pathname) { - return Open(pathname, O_RDWR | O_NOCTTY | O_CLOEXEC | O_NONBLOCK); + return Open(pathname, O_RDWR | O_NONBLOCK); } bool