[update_engine] Fix file creation mask to be 0600
In addition to changing the write() call in utils.cc, I also set the umask
of the process to be 177 -- meaning that files will be AT MOST -rw-------
I do this _after_ we initialize logging, so that we don't create log files
with unnecessarily restrictive permissions.
BUG=chromium-os:6581
TEST=Unit tests,
Change-Id: Id6b805a1524af391755bc1df69ec0f6c382154c2
[update_engine] Ensure that created files have restrictive permissions
Change-Id: If93e043465083f7c48619d0e7163dd73f8c46090
Review URL: http://codereview.chromium.org/3495002
diff --git a/split_file_writer.h b/split_file_writer.h
index cba8161..508cae0 100644
--- a/split_file_writer.h
+++ b/split_file_writer.h
@@ -25,13 +25,13 @@
first_mode_(0),
second_file_writer_(second_file_writer),
bytes_received_(0) {}
-
+
void SetFirstOpenArgs(const char* path, int flags, mode_t mode) {
first_path_ = path;
first_flags_ = flags;
first_mode_ = mode;
}
-
+
// If both succeed, returns the return value from the second Open() call.
// On error, both files will be left closed.
virtual int Open(const char* path, int flags, mode_t mode);
@@ -47,11 +47,11 @@
const char* first_path_;
int first_flags_;
mode_t first_mode_;
-
- // The scond file writeer.
+
+ // The second file writer.
FileWriter* const second_file_writer_;
- // Bytes written thus far
+ // Bytes written thus far.
off_t bytes_received_;
char first_length_buf_[sizeof(uint64_t)];