Provide a compile-time parameter to set the default file creation permissions

under Unix.  Ticket #1247. (CVS 2461)

FossilOrigin-Name: bfa55bec3233eed899606c309773f441857605ae
This commit is contained in:
drh 2005-05-17 11:25:31 +00:00
parent c43e8be80c
commit 8e855770de
4 changed files with 19 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Fix\san\suninitialized\svariable.\s\sTicket\s#1244.\s(CVS\s2460)
D 2005-05-16T22:37:55
C Provide\sa\scompile-time\sparameter\sto\sset\sthe\sdefault\sfile\screation\spermissions\nunder\sUnix.\s\sTicket\s#1247.\s(CVS\s2461)
D 2005-05-17T11:25:32
F Makefile.in 5c00d0037104de2a50ac7647a5f12769795957a3
F Makefile.linux-gcc 06be33b2a9ad4f005a5f42b22c4a19dab3cbb5c7
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -48,8 +48,8 @@ F src/os.h e5438be25cf96858787bf9b60fc7a2420e139ee3
F src/os_common.h 0e7f428ba0a6c40a61bc56c4e96f493231301b73
F src/os_test.c 91e5f22dd89491e5e1554820e715805f43fa4ece
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c fba0167576f09e242afd4c4978e1d2944b1da8b5
F src/os_unix.h 40b2fd1d02cfa45d6c3dea25316fd019cf9fcb0c
F src/os_unix.c cb8a39901b8eb920372c2e42f7ea9ab40f2e47ae
F src/os_unix.h 39a393252e69e72b06715c9958df05ddbc4aa971
F src/os_win.c 2bbbe6fbb010763c3fa79d5e951afca9b138c6b5
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c a48f537db37de0433fd1b527e64d08c1a5bcce19
@ -279,7 +279,7 @@ F www/tclsqlite.tcl 425be741b8ae664f55cb1ef2371aab0a75109cf9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 528299b8316726dbcc5548e9aa0648c8b1bd055b
P 453014421e9a739b47d4c28b0342454e4c686199
R a8e959562690a56ec75c77b6579c89c4
P 582cb77d72031f78b560f67222a0e6ce5e3ca3f2
R f86563d37c0f4ff3d3482c5acc233171
U drh
Z ea796f567b13c39f590d2469db8bced9
Z 51bafd4fe83db37b3595598eb6a48d4f

View File

@ -1 +1 @@
582cb77d72031f78b560f67222a0e6ce5e3ca3f2
bfa55bec3233eed899606c309773f441857605ae

View File

@ -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;

View File

@ -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_ */