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

Unified Diff: base/files/file_util.h

Issue 689713006: Allow POSIX callers to specify a new file's mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | base/files/file_util_posix.cc » ('j') | base/files/file_util_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_util.h
diff --git a/base/files/file_util.h b/base/files/file_util.h
index ecc0d581dab8a29f70d6d1463c6aacd6d45b3e9a..c3aa3f1cf909cc220f24575f00754c13ddd056d2 100644
--- a/base/files/file_util.h
+++ b/base/files/file_util.h
@@ -322,6 +322,8 @@ BASE_EXPORT int ReadFile(const FilePath& filename, char* data, int max_size);
// Writes the given buffer into the file, overwriting any data that was
// previously there. Returns the number of bytes written, or -1 on error.
+// The file will be created with a default mode (POSIX) or security
+// descriptor (Windows). To specify a mode on POSIX, use |WriteFileWithMode|.
BASE_EXPORT int WriteFile(const FilePath& filename, const char* data,
int size);
@@ -329,6 +331,12 @@ BASE_EXPORT int WriteFile(const FilePath& filename, const char* data,
// Appends |data| to |fd|. Does not close |fd| when done. Returns true iff
// |size| bytes of |data| were written to |fd|.
BASE_EXPORT bool WriteFileDescriptor(const int fd, const char* data, int size);
+
+// Writes the given buffer into the file, overwriting any data that was
+// previously there. Returns true iff |size| bytes of |data| were written to
+// |filename|. The file is created with the given |mode|.
+BASE_EXPORT bool WriteFileWithMode(const FilePath& filename, const char* data,
+ int size, mode_t mode);
#endif
// Appends |data| to |filename|. Returns true iff |size| bytes of |data| were
« no previous file with comments | « no previous file | base/files/file_util_posix.cc » ('j') | base/files/file_util_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698