/ Check-in [1d808690]
Login

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

Overview
Comment:Do not attempt to set the permissions on an existing journal or wal file. Do this only immediately after creating a new file (or opening one zero bytes in size).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1:1d8086902ee96347491bce5ec04dc92ccd42efa1
User & Date: dan 2013-03-05 15:27:34
References
2013-03-06
01:41
Fix an operator precedence problem on the [1d8086902e] check-in. Closed-Leaf check-in: 4f5f3aeb user: drh tags: ex-robust-open
Context
2013-03-05
16:54
Failed merge experimental branch with trunk. check-in: 4e6e07a6 user: dan tags: ex-robust-open
15:27
Do not attempt to set the permissions on an existing journal or wal file. Do this only immediately after creating a new file (or opening one zero bytes in size). Closed-Leaf check-in: 1d808690 user: dan tags: experimental
15:09
Add extended error code SQLITE_READONLY_ROLLBACK. Returned if a read-only connection cannot read the database because doing so would require it to roll back a hot-journal. check-in: 39247b14 user: dan tags: experimental
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

   548    548   #else
   549    549       fd = osOpen(z,f,m2);
   550    550   #endif
   551    551     }while( fd<0 && errno==EINTR );
   552    552     if( fd>=0 ){
   553    553       if( m!=0 ){
   554    554         struct stat statbuf;
   555         -      if( osFstat(fd, &statbuf)==0 && (statbuf.st_mode&0777)!=m ){
          555  +      if( osFstat(fd, &statbuf)==0 
          556  +       && statbuf.st_size==0
          557  +       && statbuf.st_mode&0777!=m 
          558  +      ){
   556    559           osFchmod(fd, m);
   557    560         }
   558    561       }
   559    562   #if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
   560    563       osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
   561    564   #endif
   562    565     }

Changes to test/pager1.test.

   748    748   
   749    749   faultsim_restore_and_reopen
   750    750   db close
   751    751   sqlite3 db test.db -readonly 1
   752    752   do_catchsql_test pager1.4.5.6 {
   753    753     SELECT * FROM t1;
   754    754     SELECT * FROM t2;
   755         -} {1 {disk I/O error}}
          755  +} {1 {attempt to write a readonly database}}
   756    756   db close
   757    757   
   758    758   # Snapshot the file-system just before multi-file commit. Save the name
   759    759   # of the master journal file in $::mj_filename.
   760    760   #
   761    761   tv script copy_on_mj_delete
   762    762   tv filter xDelete