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

Unified Diff: base/platform_file_posix.cc

Issue 15861011: Add an "append flag" to base::PlatformFile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Indentation style, missing semicolon Created 7 years, 6 months 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
Index: base/platform_file_posix.cc
diff --git a/base/platform_file_posix.cc b/base/platform_file_posix.cc
index beae804c629c86a6b8fa4ef716f601552d9a114e..a8be8a4a95ec4351c824f1fece257a00af033dfc 100644
--- a/base/platform_file_posix.cc
+++ b/base/platform_file_posix.cc
@@ -81,6 +81,7 @@ PlatformFile CreatePlatformFileUnsafe(const FilePath& name,
open_flags |= O_WRONLY;
} else if (!(flags & PLATFORM_FILE_READ) &&
!(flags & PLATFORM_FILE_WRITE_ATTRIBUTES) &&
+ !(flags & PLATFORM_FILE_APPEND) &&
!(flags & PLATFORM_FILE_OPEN_ALWAYS)) {
NOTREACHED();
}
@@ -88,6 +89,11 @@ PlatformFile CreatePlatformFileUnsafe(const FilePath& name,
if (flags & PLATFORM_FILE_TERMINAL_DEVICE)
open_flags |= O_NOCTTY | O_NDELAY;
+ if (flags & PLATFORM_FILE_APPEND && flags & PLATFORM_FILE_READ)
+ open_flags |= O_APPEND | O_RDWR;
+ else if (flags & PLATFORM_FILE_APPEND)
+ open_flags |= O_APPEND | O_WRONLY;
+
COMPILE_ASSERT(O_RDONLY == 0, O_RDONLY_must_equal_zero);
int mode = S_IRUSR | S_IWUSR;

Powered by Google App Engine
This is Rietveld 408576698