system/FileDescriptor: move O_NOCTTY|O_CLOEXEC to Open()

This commit is contained in:
Max Kellermann 2015-03-03 22:20:51 +01:00
parent 57ad3aca8e
commit 4dec12fcfc

View File

@ -60,14 +60,14 @@
bool bool
FileDescriptor::Open(const char *pathname, int flags) FileDescriptor::Open(const char *pathname, int flags)
{ {
fd = ::open(pathname, flags); fd = ::open(pathname, flags | O_NOCTTY | O_CLOEXEC);
return IsDefined(); return IsDefined();
} }
bool bool
FileDescriptor::OpenReadOnly(const char *pathname) FileDescriptor::OpenReadOnly(const char *pathname)
{ {
return Open(pathname, O_RDONLY | O_NOCTTY | O_CLOEXEC); return Open(pathname, O_RDONLY);
} }
#ifndef WIN32 #ifndef WIN32
@ -75,7 +75,7 @@ FileDescriptor::OpenReadOnly(const char *pathname)
bool bool
FileDescriptor::OpenNonBlocking(const char *pathname) FileDescriptor::OpenNonBlocking(const char *pathname)
{ {
return Open(pathname, O_RDWR | O_NOCTTY | O_CLOEXEC | O_NONBLOCK); return Open(pathname, O_RDWR | O_NONBLOCK);
} }
bool bool