/ Check-in [bfa55bec]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Provide a compile-time parameter to set the default file creation permissions under Unix. Ticket #1247. (CVS 2461)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:bfa55bec3233eed899606c309773f441857605ae
User & Date: drh 2005-05-17 11:25:32
Context
2005-05-19
01:26
Fix an array index that is out of bounds. Ticket #1251. (CVS 2462) check-in: bcf87e4d user: drh tags: trunk
2005-05-17
11:25
Provide a compile-time parameter to set the default file creation permissions under Unix. Ticket #1247. (CVS 2461) check-in: bfa55bec user: drh tags: trunk
2005-05-16
22:37
Fix an uninitialized variable. Ticket #1244. (CVS 2460) check-in: 582cb77d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

   428    428     const char *zFilename,
   429    429     OsFile *id,
   430    430     int *pReadonly
   431    431   ){
   432    432     int rc;
   433    433     assert( !id->isOpen );
   434    434     id->dirfd = -1;
   435         -  id->h = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY, 0644);
          435  +  id->h = open(zFilename, O_RDWR|O_CREAT|O_LARGEFILE|O_BINARY,
          436  +                          SQLITE_DEFAULT_FILE_PERMISSIONS);
   436    437     if( id->h<0 ){
   437    438   #ifdef EISDIR
   438    439       if( errno==EISDIR ){
   439    440         return SQLITE_CANTOPEN;
   440    441       }
   441    442   #endif
   442    443       id->h = open(zFilename, O_RDONLY|O_LARGEFILE|O_BINARY);
................................................................................
   557    558   ){
   558    559     if( !id->isOpen ){
   559    560       /* Do not open the directory if the corresponding file is not already
   560    561       ** open. */
   561    562       return SQLITE_CANTOPEN;
   562    563     }
   563    564     assert( id->dirfd<0 );
   564         -  id->dirfd = open(zDirname, O_RDONLY|O_BINARY, 0644);
          565  +  id->dirfd = open(zDirname, O_RDONLY|O_BINARY, 0);
   565    566     if( id->dirfd<0 ){
   566    567       return SQLITE_CANTOPEN; 
   567    568     }
   568    569     TRACE3("OPENDIR %-3d %s\n", id->dirfd, zDirname);
   569    570     return SQLITE_OK;
   570    571   }
   571    572   
................................................................................
   780    781   ** before making changes to individual journals on a multi-database commit.
   781    782   ** The F_FULLFSYNC option is not needed here.
   782    783   */
   783    784   int sqlite3OsSyncDirectory(const char *zDirname){
   784    785     int fd;
   785    786     int r;
   786    787     SimulateIOError(SQLITE_IOERR);
   787         -  fd = open(zDirname, O_RDONLY|O_BINARY, 0644);
          788  +  fd = open(zDirname, O_RDONLY|O_BINARY, 0);
   788    789     TRACE3("DIRSYNC %-3d (%s)\n", fd, zDirname);
   789    790     if( fd<0 ){
   790    791       return SQLITE_CANTOPEN; 
   791    792     }
   792    793     r = fsync(fd);
   793    794     close(fd);
   794    795     return ((r==0)?SQLITE_OK:SQLITE_IOERR);

Changes to src/os_unix.h.

    87     87   */
    88     88   #if defined(HAVE_USLEEP) && HAVE_USLEEP
    89     89   # define SQLITE_MIN_SLEEP_MS 1
    90     90   #else
    91     91   # define SQLITE_MIN_SLEEP_MS 1000
    92     92   #endif
    93     93   
           94  +/*
           95  +** Default permissions when creating a new file
           96  +*/
           97  +#ifndef SQLITE_DEFAULT_FILE_PERMISSIONS
           98  +# define SQLITE_DEFAULT_FILE_PERMISSIONS 0644
           99  +#endif
          100  +
    94    101   
    95    102   #endif /* _SQLITE_OS_UNIX_H_ */