Index: base/platform_file_posix.cc |
=================================================================== |
--- base/platform_file_posix.cc (revision 24791) |
+++ base/platform_file_posix.cc (working copy) |
@@ -52,6 +52,10 @@ |
*created = false; |
} else { |
open_flags |= O_CREAT; |
+ if (flags & PLATFORM_FILE_EXCLUSIVE_READ || |
+ flags & PLATFORM_FILE_EXCLUSIVE_WRITE) { |
+ open_flags |= O_EXCL; // together with O_CREAT implies O_NOFOLLOW |
+ } |
descriptor = open(WideToUTF8(name).c_str(), open_flags, |
S_IRUSR | S_IWUSR); |
if (created && descriptor > 0) |
@@ -59,7 +63,15 @@ |
} |
} |
+ if ((descriptor > 0) && (flags & PLATFORM_FILE_DELETE_ON_CLOSE)) { |
+ unlink(WideToUTF8(name).c_str()); |
+ } |
+ |
return descriptor; |
} |
+bool ClosePlatformFile(PlatformFile file) { |
+ return close(file); |
+} |
+ |
} // namespace base |