Summary:
writeFileAtomic variants all have a mode, lets just hoist the mode parameter
up and use what was hardcoded as the default.
Reviewed By: Orvid
Differential Revision:
D5341481
fbshipit-source-id:
6976915dd73d2382b42bd991782730601b918978
* state will be unchanged on error.
*/
template <class Container>
* state will be unchanged on error.
*/
template <class Container>
-bool writeFile(const Container& data, const char* filename,
- int flags = O_WRONLY | O_CREAT | O_TRUNC) {
+bool writeFile(const Container& data,
+ const char* filename,
+ int flags = O_WRONLY | O_CREAT | O_TRUNC,
+ mode_t mode = 0666) {
static_assert(sizeof(data[0]) == 1,
"writeFile works with element size equal to 1");
static_assert(sizeof(data[0]) == 1,
"writeFile works with element size equal to 1");
- int fd = open(filename, flags, 0666);
+ int fd = open(filename, flags, mode);
if (fd == -1) {
return false;
}
if (fd == -1) {
return false;
}