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

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: fixes 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
« no previous file with comments | « tools/generate_dump.cc ('k') | util/file/file_io_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/file/file_io.h
diff --git a/util/file/file_io.h b/util/file/file_io.h
index 901566c79db3cc4b07ba5f980eadf0d4202d1b1c..ef22e2d7637b558f38c492cd36db990d421c2db1 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 value that is passed
+//! 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698