Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Unified Diff: runtime/bin/file_macos.cc

Issue 11416009: Fixed missing O_CLOEXEC in Mac OS (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_macos.cc
diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc
index fccd648d5cab8c8f9e15fa5c8fe023c156d378e4..b5bc95a9c43c7c217aa56329e5c37f4be6d581a8 100644
--- a/runtime/bin/file_macos.cc
+++ b/runtime/bin/file_macos.cc
@@ -12,6 +12,7 @@
#include <limits.h>
#include "bin/builtin.h"
+#include "bin/fdutils.h"
class FileHandle {
public:
@@ -116,11 +117,11 @@ File* File::Open(const char* name, FileOpenMode mode) {
if ((mode & kTruncate) != 0) {
flags = flags | O_TRUNC;
}
- flags |= O_CLOEXEC;
int fd = TEMP_FAILURE_RETRY(open(name, flags, 0666));
if (fd < 0) {
return NULL;
}
+ FDUtils::SetCloseOnExec(fd);
if (((mode & kWrite) != 0) && ((mode & kTruncate) == 0)) {
int position = TEMP_FAILURE_RETRY(lseek(fd, 0, SEEK_END));
if (position < 0) {
@@ -148,7 +149,7 @@ bool File::Exists(const char* name) {
bool File::Create(const char* name) {
- int fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_CREAT | O_CLOEXEC, 0666));
+ int fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_CREAT, 0666));
if (fd < 0) {
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698