diff options
author | drh <drh@noemail.net> | 2017-12-13 20:35:34 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2017-12-13 20:35:34 +0000 |
commit | 258dfe48cf8edd4972c60545b7c08394af504fa7 (patch) | |
tree | bfc8eeeb0b66539832beb2ec13a28a96e8434a33 /src/os_unix.c | |
parent | a803a2cd9889cb3b4db1029110281370576bf354 (diff) | |
download | sqlite-258dfe48cf8edd4972c60545b7c08394af504fa7.tar.gz sqlite-258dfe48cf8edd4972c60545b7c08394af504fa7.zip |
An improved way of generating the SQLITE_READONLY_DIRECTORY error.
The error message submitted to sqlite3_log() is still correct this way.
FossilOrigin-Name: 1c0aa919ee429cd194820ec9c54084563f39e63fd399b23f859fc6703b429b15
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index e82cec233..2d377ef56 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -5904,12 +5904,6 @@ static int unixOpen( fd = robust_open(zName, openFlags, openMode); OSTRACE(("OPENX %-3d %s 0%o\n", fd, zName, openFlags)); assert( !isExclusive || (openFlags & O_CREAT)!=0 ); - if( fd<0 && isNewJrnl && osAccess(zName, F_OK) ){ - /* Trying to create a journal file where we don't have write - ** permission on the directory */ - rc = unixLogError(SQLITE_READONLY_DIRECTORY, "open", zName); - goto open_finished; - } if( fd<0 && errno!=EISDIR && isReadWrite ){ /* Failed to open the file for read/write access. Try read-only. */ flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE); @@ -5921,6 +5915,9 @@ static int unixOpen( } if( fd<0 ){ rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zName); + /* If unable to create a journal, change the error code to + ** indicate that the directory permissions are wrong. */ + if( isNewJrnl && osAccess(zName, F_OK) ) rc = SQLITE_READONLY_DIRECTORY; goto open_finished; } |