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

Unified Diff: util/file/file_io.h

Issue 821483002: Change 'bool world_readable' to an enum (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 6 years 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: util/file/file_io.h
diff --git a/util/file/file_io.h b/util/file/file_io.h
index 901566c79db3cc4b07ba5f980eadf0d4202d1b1c..8a445bd54952b40d81a4ebcf136afc8386a2bd82 100644
--- a/util/file/file_io.h
+++ b/util/file/file_io.h
@@ -64,6 +64,15 @@ enum class FileWriteMode {
kCreateOrFail,
};
+//! \brief Determines the permissions bits for files created on POSIX systems.
+enum class FilePermissions : bool {
+ //! \brief Equivalent to `0600`.
+ kOwnerOnly,
+
+ //! \brief Equivalent to `0644`.
+ kWorldReadable,
+};
+
//! \brief Reads from a file, retrying when interrupted on POSIX or following a
//! short read.
//!
@@ -166,18 +175,18 @@ FileHandle LoggingOpenFileForRead(const base::FilePath& path);
//! an error if the operation fails.
//!
//! \a write_mode determines the style (truncate, reuse, etc.) that is used to
-//! open the file. On POSIX, if \a world_readable, `0644` will be used as
-//! `mode` permissions bits for `open()`, otherwise `0600` will be used. On
-//! Windows, the file is always opened in binary mode (that is, no CRLF
-//! translation).
+//! open the file. On POSIX, \a permissions determines the mask that is passed
Mark Mentovai 2014/12/19 23:26:32 value, not mask. Even though there’s mathematicall
scottmg 2014/12/19 23:33:14 Done.
+//! as `mode` to `open()`. On Windows, the file is always opened in binary mode
+//! (that is, no CRLF translation).
//!
//! \return The newly opened FileHandle, or an invalid FileHandle on failure.
//!
//! \sa FileWriteMode
+//! \sa FilePermissions
//! \sa ScopedFileHandle
FileHandle LoggingOpenFileForWrite(const base::FilePath& path,
FileWriteMode write_mode,
- bool world_readable);
+ FilePermissions permissions);
//! \brief Wraps `lseek()` or `SetFilePointerEx()`. Logs an error if the
//! operation fails.
« no previous file with comments | « tools/generate_dump.cc ('k') | util/file/file_io_posix.cc » ('j') | util/file/file_io_posix.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698