SQLite

Check-in [180516bf7b]
Login

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

Overview
Comment:Bring the code that changes the owner of WAL and rollback files when running as root into alignment with trunk.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA3-256: 180516bf7bd5a61c11b1eef2c8c13ac63c7b00f821bb89393fc68d39852202de
User & Date: drh 2018-05-04 20:00:13.195
Context
2018-05-07
13:01
Merge enhancements from trunk, and especially the cell-overwrite optimization. (check-in: cb3aa77802 user: drh tags: apple-osx)
2018-05-04
20:00
Bring the code that changes the owner of WAL and rollback files when running as root into alignment with trunk. (check-in: 180516bf7b user: drh tags: apple-osx)
19:33
Merge recent enhancements from trunk. (check-in: e17bca2cdb user: drh tags: apple-osx)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/os_unix.c.
7142
7143
7144
7145
7146
7147
7148
7149

7150
7151
7152

7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7142
7143
7144
7145
7146
7147
7148

7149



7150




7151
7152
7153
7154
7155
7156
7157







-
+
-
-
-
+
-
-
-
-







      int rc2 = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zName);
      if( rc==SQLITE_OK ) rc = rc2;
      goto open_finished;
    }

    /* if we're opening the wal or journal and running as root, set the
    ** journal uid/gid */
    if( !isReadonly && (flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL)) ){
    if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){
      uid_t euid = geteuid();
      if( euid==0 && (euid!=uid || getegid()!=gid) ){
        if( robustFchown(fd, uid, gid) ){
      robustFchown(fd, uid, gid);
          rc = SQLITE_CANTOPEN_BKPT;
          goto open_finished;
        }
      }
    }
  }
  assert( fd>=0 );
  if( pOutFlags ){
    *pOutFlags = flags;
  }