changeset 8:12be3560ff0f

open(2) needs a third argument when O_CREAT is specified: give it modes of 0666 (like touch(1) does) as the mode is modified by the user's umask.
author mas01cr
date Wed, 25 Jul 2007 15:39:26 +0000
parents bd6bb994081b
children 378c2483c926
files audioDB.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/audioDB.cpp	Tue Jul 24 15:36:07 2007 +0000
+++ b/audioDB.cpp	Wed Jul 25 15:39:26 2007 +0000
@@ -416,8 +416,8 @@
 */
 
 void audioDB::create(const char* dbName){
-  if ((dbfid = open (dbName, O_RDWR | O_CREAT | O_TRUNC)) < 0)
-    error("Can't open database file:", dbName);
+  if ((dbfid = open (dbName, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) < 0)
+    error("Can't open database file", dbName);
 
   // go to the location corresponding to the last byte
   if (lseek (dbfid, O2_DEFAULTDBSIZE - 1, SEEK_SET) == -1)