Index: base/files/file_util_posix.cc |
diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc |
index 5a94cef661319e39b98ea10037113371b4a2d2ac..93275552e76468f55bc7b1c5aba67d9533a71aee 100644 |
--- a/base/files/file_util_posix.cc |
+++ b/base/files/file_util_posix.cc |
@@ -693,6 +693,18 @@ int WriteFile(const FilePath& filename, const char* data, int size) { |
return bytes_written; |
} |
+bool WriteFileWithMode(const FilePath& filename, const char* data, int size, |
+ mode_t mode) { |
+ ThreadRestrictions::AssertIOAllowed(); |
+ int fd = HANDLE_EINTR(creat(filename.value().c_str(), mode)); |
rvargas (doing something else)
2014/10/22 00:57:38
tiny nit: declare fd (or file) directly to be a Sc
palmer
2014/10/22 01:03:02
Done.
|
+ if (fd < 0) |
+ return false; |
+ |
+ ScopedFD file(fd); |
+ bool status = WriteFileDescriptor(file.get(), data, size); |
rvargas (doing something else)
2014/10/22 00:57:38
tiny nit: return directly here.
palmer
2014/10/22 01:03:02
Done.
|
+ return status; |
+} |
+ |
bool WriteFileDescriptor(const int fd, const char* data, int size) { |
// Allow for partial writes. |
ssize_t bytes_written_total = 0; |