SQLite

Check-in [1f930d7e04]
Login

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

Overview
Comment:Make use of the sqlite3GetBoolean() interface for more robust processing of the readonly_shm query parameter inside of unixShmMap().
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | wal-readonly
Files: files | file ages | folders
SHA1: 1f930d7e04cd4a5ff3d91a0e9f1b62114f1cebd2
User & Date: drh 2011-06-01 20:13:36.269
Original Comment: Make use of the sqlite3GetBoolean() interface for more robust processing of the readonly_shm query parameter inside of unixShmMap().
Context
2011-06-02
13:04
Merge the read-only shared memory branch into trunk. After this merge, an unprivileged process can open WAL-mode databases owned by another user as long as a database connection with write permission exists on the database file and if the readonly_shm=1 URI query parameter is supplied. (check-in: 19084a6641 user: drh tags: trunk)
2011-06-01
20:13
Make use of the sqlite3GetBoolean() interface for more robust processing of the readonly_shm query parameter inside of unixShmMap(). (Closed-Leaf check-in: 1f930d7e04 user: drh tags: wal-readonly)
20:01
Simplify the wal-readonly branch so that it does not require changes to anything other than os_unix.c and wal.c and a couple of new error codes. (check-in: d6b4709de4 user: drh tags: wal-readonly)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_unix.c.
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797

    if( pInode->bProcessLock==0 ){
      pShmNode->h = robust_open(zShmFilename, O_RDWR|O_CREAT,
                               (sStat.st_mode & 0777));
      if( pShmNode->h<0 ){
        const char *zRO;
        zRO = sqlite3_uri_parameter(pDbFd->zPath, "readonly_shm");
        if( zRO && (zRO[0]!='0' || zRO[1]!=0) ){
          pShmNode->h = robust_open(zShmFilename, O_RDONLY,
                                    (sStat.st_mode & 0777));
          pShmNode->isReadonly = 1;
        }
        if( pShmNode->h<0 ){
          rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zShmFilename);
          goto shm_open_err;







|







3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797

    if( pInode->bProcessLock==0 ){
      pShmNode->h = robust_open(zShmFilename, O_RDWR|O_CREAT,
                               (sStat.st_mode & 0777));
      if( pShmNode->h<0 ){
        const char *zRO;
        zRO = sqlite3_uri_parameter(pDbFd->zPath, "readonly_shm");
        if( zRO && sqlite3GetBoolean(zRO) ){
          pShmNode->h = robust_open(zShmFilename, O_RDONLY,
                                    (sStat.st_mode & 0777));
          pShmNode->isReadonly = 1;
        }
        if( pShmNode->h<0 ){
          rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zShmFilename);
          goto shm_open_err;