From d3ee99f796194d4506cbc9cedc172c62141934eb Mon Sep 17 00:00:00 2001 From: Philip Pronin Date: Wed, 5 Mar 2014 17:45:28 -0800 Subject: [PATCH] use 0666 as the default permissions for new files Summary: Seems like there is no real need to restrict permissions by default? Test Plan: fbconfig -r folly/test && fbmake runtests_opt @override-unit-failures Reviewed By: tudorb@fb.com FB internal diff: D1205527 --- folly/File.h | 2 +- folly/FileUtil.h | 2 +- folly/experimental/TestUtil.cpp | 2 +- folly/experimental/test/TestUtilTest.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/folly/File.h b/folly/File.h index 39136d4a..55608891 100644 --- a/folly/File.h +++ b/folly/File.h @@ -43,7 +43,7 @@ class File { /** * Open and create a file object. Throws on error. */ - explicit File(const char* name, int flags = O_RDONLY, mode_t mode = 0644); + explicit File(const char* name, int flags = O_RDONLY, mode_t mode = 0666); ~File(); diff --git a/folly/FileUtil.h b/folly/FileUtil.h index d674dc2e..13dbe5a0 100644 --- a/folly/FileUtil.h +++ b/folly/FileUtil.h @@ -37,7 +37,7 @@ namespace folly { * until all data is written. Note that *Full wrappers weaken the thread * semantics of underlying system calls. */ -int openNoInt(const char* name, int flags, mode_t mode=0644); +int openNoInt(const char* name, int flags, mode_t mode = 0666); int closeNoInt(int fd); int dupNoInt(int fd); int dup2NoInt(int oldfd, int newfd); diff --git a/folly/experimental/TestUtil.cpp b/folly/experimental/TestUtil.cpp index 7a2d5999..095489e4 100644 --- a/folly/experimental/TestUtil.cpp +++ b/folly/experimental/TestUtil.cpp @@ -51,7 +51,7 @@ TemporaryFile::TemporaryFile(StringPiece namePrefix, closeOnDestruction_(closeOnDestruction), fd_(-1), path_(generateUniquePath(std::move(dir), namePrefix)) { - fd_ = open(path_.c_str(), O_RDWR | O_CREAT | O_EXCL, 0644); + fd_ = open(path_.c_str(), O_RDWR | O_CREAT | O_EXCL, 0666); checkUnixError(fd_, "open failed"); if (scope_ == Scope::UNLINK_IMMEDIATELY) { diff --git a/folly/experimental/test/TestUtilTest.cpp b/folly/experimental/test/TestUtilTest.cpp index 1d152a88..cfa56264 100644 --- a/folly/experimental/test/TestUtilTest.cpp +++ b/folly/experimental/test/TestUtilTest.cpp @@ -81,7 +81,7 @@ void testTemporaryDirectory(TemporaryDirectory::Scope scope) { EXPECT_TRUE(fs::is_directory(path)); fs::path fp = path / "bar"; - int fd = open(fp.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0644); + int fd = open(fp.c_str(), O_RDWR | O_CREAT | O_TRUNC, 0666); EXPECT_NE(fd, -1); close(fd); -- 2.34.1