aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-09-20 03:39:43 -0700
committerEric Wong <normalperson@yhbt.net>2008-09-20 03:39:43 -0700
commitdf1ed6f83043b7290d27b49c3c63fc8bcb796d5c (patch)
tree70a6ef6e795be45dedd863ce63983d22910ef706
parent1087b54a46feacb5a6a46d99df77345be8d4d54d (diff)
downloadmpd-df1ed6f83043b7290d27b49c3c63fc8bcb796d5c.tar.gz
mpd-df1ed6f83043b7290d27b49c3c63fc8bcb796d5c.tar.xz
mpd-df1ed6f83043b7290d27b49c3c63fc8bcb796d5c.zip
Oops, open() with O_CREAT is nicer with a mode
Respect the user's umask (and the number of the beast!)
-rw-r--r--src/directory.c2
-rw-r--r--src/state_file.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/directory.c b/src/directory.c
index 06a39d7bf..c07f9edcb 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -1042,7 +1042,7 @@ int writeDirectoryDB(void)
DEBUG("writing DB\n");
- while (((fd = open(dbFile, O_WRONLY|O_TRUNC|O_CREAT)) < 0) &&
+ while (((fd = open(dbFile, O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0) &&
errno == EINTR);
if (fd < 0) {
ERROR("unable to write to db file \"%s\": %s\n",
diff --git a/src/state_file.c b/src/state_file.c
index b7f28e538..365baec0f 100644
--- a/src/state_file.c
+++ b/src/state_file.c
@@ -55,7 +55,7 @@ void write_state_file(void)
if (!sfpath)
return;
- while (((fd = open(sfpath, O_WRONLY|O_TRUNC|O_CREAT)) < 0) &&
+ while (((fd = open(sfpath, O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0) &&
errno == EINTR);
if (fd < 0) {
ERROR("problems opening state file \"%s\" for writing: %s\n",