aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2005-05-17 11:25:31 +0000
committerdrh <drh@noemail.net>2005-05-17 11:25:31 +0000
commit8e855770deccb7a6634adaddab26e2857f19e57f (patch)
tree5d3f72c3968e0e973e08cb0b6dc942bb119fdf5d /src
parentc43e8be80ca4a0db4e5927d0a703be95bdb03b21 (diff)
downloadsqlite-8e855770deccb7a6634adaddab26e2857f19e57f.tar.gz
sqlite-8e855770deccb7a6634adaddab26e2857f19e57f.zip
Provide a compile-time parameter to set the default file creation permissions
under Unix. Ticket #1247. (CVS 2461) FossilOrigin-Name: bfa55bec3233eed899606c309773f441857605ae
Diffstat (limited to 'src')
-rw-r--r--src/os_unix.c7
-rw-r--r--src/os_unix.h7
2 files changed, 11 insertions, 3 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 83de58f03..eb0d870bb 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -432,7 +432,8 @@ int sqlite3OsOpenReadWrite(
int rc;
assert( !id->isOpen );
id->dirfd = -1;
- id->h = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY, 0644);
+ id->h = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY,
+ SQLITE_DEFAULT_FILE_PERMISSIONS);
if( id->h<0 ){
#ifdef EISDIR
if( errno==EISDIR ){
@@ -561,7 +562,7 @@ int sqlite3OsOpenDirectory(
return SQLITE_CANTOPEN;
}
assert( id->dirfd<0 );
- id->dirfd = open(zDirname, O_RDONLY|O_BINARY, 0644);
+ id->dirfd = open(zDirname, O_RDONLY|O_BINARY, 0);
if( id->dirfd<0 ){
return SQLITE_CANTOPEN;
}
@@ -784,7 +785,7 @@ int sqlite3OsSyncDirectory(const char *zDirname){
int fd;
int r;
SimulateIOError(SQLITE_IOERR);
- fd = open(zDirname, O_RDONLY|O_BINARY, 0644);
+ fd = open(zDirname, O_RDONLY|O_BINARY, 0);
TRACE3("DIRSYNC %-3d (%s)\n", fd, zDirname);
if( fd<0 ){
return SQLITE_CANTOPEN;
diff --git a/src/os_unix.h b/src/os_unix.h
index 720896255..4ea0aee36 100644
--- a/src/os_unix.h
+++ b/src/os_unix.h
@@ -91,5 +91,12 @@ struct OsFile {
# define SQLITE_MIN_SLEEP_MS 1000
#endif
+/*
+** Default permissions when creating a new file
+*/
+#ifndef SQLITE_DEFAULT_FILE_PERMISSIONS
+# define SQLITE_DEFAULT_FILE_PERMISSIONS 0644
+#endif
+
#endif /* _SQLITE_OS_UNIX_H_ */