Mercurial > hg > audiodb
comparison audioDB.cpp @ 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 | 9eab3e0f3068 |
children | 378c2483c926 |
comparison
equal
deleted
inserted
replaced
7:bd6bb994081b | 8:12be3560ff0f |
---|---|
414 O2_MAXFILES * 02_MEANNUMFEATURES * sizeof(DOUBLE) | 414 O2_MAXFILES * 02_MEANNUMFEATURES * sizeof(DOUBLE) |
415 | 415 |
416 */ | 416 */ |
417 | 417 |
418 void audioDB::create(const char* dbName){ | 418 void audioDB::create(const char* dbName){ |
419 if ((dbfid = open (dbName, O_RDWR | O_CREAT | O_TRUNC)) < 0) | 419 if ((dbfid = open (dbName, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) < 0) |
420 error("Can't open database file:", dbName); | 420 error("Can't open database file", dbName); |
421 | 421 |
422 // go to the location corresponding to the last byte | 422 // go to the location corresponding to the last byte |
423 if (lseek (dbfid, O2_DEFAULTDBSIZE - 1, SEEK_SET) == -1) | 423 if (lseek (dbfid, O2_DEFAULTDBSIZE - 1, SEEK_SET) == -1) |
424 error("lseek error in db file"); | 424 error("lseek error in db file"); |
425 | 425 |