| Index: base/files/file_util.h
|
| diff --git a/base/files/file_util.h b/base/files/file_util.h
|
| index 77a87e7dade7df8db204dfd33aaafe7209c8a06b..06f3fc1e2c11e7156e029b82547172bd75c57427 100644
|
| --- a/base/files/file_util.h
|
| +++ b/base/files/file_util.h
|
| @@ -35,6 +35,22 @@
|
| #include "base/posix/eintr_wrapper.h"
|
| #endif
|
|
|
| +// fopen() takes a mode string that is typically something along the lines of
|
| +// "r" or "w+". By default, files opened via fopen() are opened such that they
|
| +// spill into child processes via the normal platform features (e.g., the file
|
| +// is opened with bInheritHandle=TRUE in its security descriptor on Windows).
|
| +// The character for a mode string to disable this spillage is not consistent
|
| +// across platforms. Define the macro FONE (i.e., "fopen 'N' or 'e'") for use in
|
| +// cross platform code that calls base::OpenFile (or calls fopen directly).
|
| +#if defined(OS_WIN)
|
| +// "N" specifies that the underlying handle is not inherited by child processes
|
| +// (bInheritHandle=FALSE).
|
| +#define FONE "N"
|
| +#else // defined(OS_WIN)
|
| +// "e" specifies that the underlying descriptor is closed on exec (FD_CLOEXEC).
|
| +#define FONE "e"
|
| +#endif // defined(OS_WIN)
|
| +
|
| namespace base {
|
|
|
| class Environment;
|
| @@ -307,7 +323,9 @@ BASE_EXPORT bool TouchFile(const FilePath& path,
|
| const Time& last_accessed,
|
| const Time& last_modified);
|
|
|
| -// Wrapper for fopen-like calls. Returns non-NULL FILE* on success.
|
| +// Wrapper for fopen-like calls. Returns non-NULL FILE* on success. By default,
|
| +// opened files will be inheritable by child processes. Append the FONE macro
|
| +// (defined above) when composing a |mode| string to disable this.
|
| BASE_EXPORT FILE* OpenFile(const FilePath& filename, const char* mode);
|
|
|
| // Closes file opened by OpenFile. Returns true on success.
|
|
|