Skip to content

Commit

Permalink
mon: use mode 0600 throughout
Browse files Browse the repository at this point in the history
Fixes: ceph#2526
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed Jun 7, 2012
1 parent 8093997 commit 7332e9c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/mon/MonitorStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void MonitorStore::put_int(version_t val, const char *a, const char *b)
char tfn[1024];
snprintf(tfn, sizeof(tfn), "%s.new", fn);

int fd = TEMP_FAILURE_RETRY(::open(tfn, O_WRONLY|O_CREAT, 0644));
int fd = TEMP_FAILURE_RETRY(::open(tfn, O_WRONLY|O_CREAT, 0600));
if (fd < 0) {
int err = errno;
derr << "MonitorStore::put_int: failed to open '" << tfn << "': "
Expand Down Expand Up @@ -308,7 +308,7 @@ int MonitorStore::write_bl_ss_impl(bufferlist& bl, const char *a, const char *b,
int err = 0;
int fd;
if (append) {
fd = ::open(fn, O_WRONLY|O_CREAT|O_APPEND, 0644);
fd = ::open(fn, O_WRONLY|O_CREAT|O_APPEND, 0600);
if (fd < 0) {
err = -errno;
derr << "failed to open " << fn << "for append: "
Expand All @@ -317,7 +317,7 @@ int MonitorStore::write_bl_ss_impl(bufferlist& bl, const char *a, const char *b,
}
} else {
snprintf(tfn, sizeof(tfn), "%s.new", fn);
fd = ::open(tfn, O_WRONLY|O_CREAT|O_TRUNC, 0644);
fd = ::open(tfn, O_WRONLY|O_CREAT|O_TRUNC, 0600);
if (fd < 0) {
err = -errno;
derr << "failed to open " << tfn << ": " << cpp_strerror(err) << dendl;
Expand Down Expand Up @@ -379,7 +379,7 @@ int MonitorStore::put_bl_sn_map(const char *a,
snprintf(fn, sizeof(fn), "%s/%llu", dfn, (long long unsigned)p->first);
snprintf(tfn, sizeof(tfn), "%s.new", fn);

int fd = ::open(tfn, O_WRONLY|O_CREAT, 0644);
int fd = ::open(tfn, O_WRONLY|O_CREAT, 0600);
if (fd < 0) {
int err = -errno;
derr << "failed to open " << tfn << ": " << cpp_strerror(err) << dendl;
Expand Down

0 comments on commit 7332e9c

Please sign in to comment.