mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-08 19:00:27 +00:00
Avoid clobbering errno in SQLite (reapply 91e167ca
)
This commit is contained in:
parent
a4d8dcbec5
commit
b382e4b93a
1 changed files with 4 additions and 0 deletions
4
third_party/sqlite3/os_unix.c
vendored
4
third_party/sqlite3/os_unix.c
vendored
|
@ -5848,6 +5848,7 @@ static int unixGetTempname(int nBuf, char *zBuf){
|
||||||
const char *zDir;
|
const char *zDir;
|
||||||
int iLimit = 0;
|
int iLimit = 0;
|
||||||
int rc = SQLITE_OK;
|
int rc = SQLITE_OK;
|
||||||
|
int e = errno; // [jart] don't pollute strace logs
|
||||||
|
|
||||||
/* It's odd to simulate an io-error here, but really this is just
|
/* It's odd to simulate an io-error here, but really this is just
|
||||||
** using the io-error infrastructure to test that SQLite handles this
|
** using the io-error infrastructure to test that SQLite handles this
|
||||||
|
@ -5875,6 +5876,7 @@ static int unixGetTempname(int nBuf, char *zBuf){
|
||||||
}while( osAccess(zBuf,0)==0 );
|
}while( osAccess(zBuf,0)==0 );
|
||||||
}
|
}
|
||||||
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_TEMPDIR));
|
||||||
|
errno = e; // [jart] don't pollute strace logs
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6415,8 +6417,10 @@ static int unixAccess(
|
||||||
|
|
||||||
if( flags==SQLITE_ACCESS_EXISTS ){
|
if( flags==SQLITE_ACCESS_EXISTS ){
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
|
int e = errno; // [jart] don't clobber errno
|
||||||
*pResOut = 0==osStat(zPath, &buf) &&
|
*pResOut = 0==osStat(zPath, &buf) &&
|
||||||
(!S_ISREG(buf.st_mode) || buf.st_size>0);
|
(!S_ISREG(buf.st_mode) || buf.st_size>0);
|
||||||
|
errno = e; // [jart] don't clobber errno
|
||||||
}else{
|
}else{
|
||||||
*pResOut = osAccess(zPath, W_OK|R_OK)==0;
|
*pResOut = osAccess(zPath, W_OK|R_OK)==0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue