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

Side by Side Diff: file_writer.h

Issue 3495002: [update_engine] Fix file creation mask to be 0600 (Closed) Base URL: http://git.chromium.org/git/update_engine.git
Patch Set: Created 10 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « extent_writer.h ('k') | main.cc » ('j') | main.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_FILE_WRITER_H__ 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_FILE_WRITER_H__
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_FILE_WRITER_H__ 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_FILE_WRITER_H__
7 7
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <fcntl.h> 10 #include <fcntl.h>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 virtual ~DirectFileWriter() {} 47 virtual ~DirectFileWriter() {}
48 48
49 virtual int Open(const char* path, int flags, mode_t mode); 49 virtual int Open(const char* path, int flags, mode_t mode);
50 virtual ssize_t Write(const void* bytes, size_t count); 50 virtual ssize_t Write(const void* bytes, size_t count);
51 virtual int Close(); 51 virtual int Close();
52 52
53 int fd() const { return fd_; } 53 int fd() const { return fd_; }
54 54
55 private: 55 private:
56 int fd_; 56 int fd_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(DirectFileWriter); 58 DISALLOW_COPY_AND_ASSIGN(DirectFileWriter);
59 }; 59 };
60 60
61 class ScopedFileWriterCloser { 61 class ScopedFileWriterCloser {
62 public: 62 public:
63 explicit ScopedFileWriterCloser(FileWriter* writer) : writer_(writer) {} 63 explicit ScopedFileWriterCloser(FileWriter* writer) : writer_(writer) {}
64 ~ScopedFileWriterCloser() { 64 ~ScopedFileWriterCloser() {
65 int err = writer_->Close(); 65 int err = writer_->Close();
66 if (err) 66 if (err)
67 LOG(ERROR) << "FileWriter::Close failed: " 67 LOG(ERROR) << "FileWriter::Close failed: "
68 << utils::ErrnoNumberAsString(-err); 68 << utils::ErrnoNumberAsString(-err);
69 } 69 }
70 private: 70 private:
71 FileWriter* writer_; 71 FileWriter* writer_;
72 72
73 DISALLOW_COPY_AND_ASSIGN(ScopedFileWriterCloser); 73 DISALLOW_COPY_AND_ASSIGN(ScopedFileWriterCloser);
74 }; 74 };
75 75
76 } // namespace chromeos_update_engine 76 } // namespace chromeos_update_engine
77 77
78 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_FILE_WRITER_H__ 78 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_FILE_WRITER_H__
OLDNEW
« no previous file with comments | « extent_writer.h ('k') | main.cc » ('j') | main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698