summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-03-03 22:20:51 +0100
committerMax Kellermann <max@duempel.org>2015-03-03 22:20:51 +0100
commit4dec12fcfc95714d325985c1684fc984e36c6d2b (patch)
treed4f2aeddc58b75575f9fe3415a50d91f361b6f9d
parent57ad3aca8ef5dbbfea2d512e9d1ae77f1fb24e37 (diff)
system/FileDescriptor: move O_NOCTTY|O_CLOEXEC to Open()
-rw-r--r--src/system/FileDescriptor.cxx6
1 files 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