Fix a benign data race in os_unix.c that might trouble tsan and similar tools.
FossilOrigin-Name: 95806ac1dabe4598170061d903ae30f09bafac149ff6696963a7e056ac846cdb
This commit is contained in:
parent
5e90794b67
commit
d9137e3be0
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Minor\stweaks\sto\sthe\sway\sauxiliary\stools\sare\sbuilt,\sto\smake\sit\seasier\sto\ncustomize\sthe\sbuilds\swithout\shaving\sto\salter\sthe\scode.
|
||||
D 2021-11-18T20:56:59.677
|
||||
C Fix\sa\sbenign\sdata\srace\sin\sos_unix.c\sthat\smight\strouble\stsan\sand\ssimilar\stools.
|
||||
D 2021-11-19T14:02:43.242
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -534,7 +534,7 @@ F src/os.c b1c4f2d485961e9a5b6b648c36687d25047c252222e9660b7cc25a6e1ea436ab
|
||||
F src/os.h 26890f540b475598cd9881dcc68931377b8d429d3ea3e2eeb64470cde64199f8
|
||||
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
|
||||
F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586
|
||||
F src/os_unix.c 8e14b40fd02f70e234030c2bee45215ff8835293adc13a08e9718c29bff61401
|
||||
F src/os_unix.c f5ad51cfd024116db8531feab9efd831c2621436dca1464e4ff1e8af9bf3252e
|
||||
F src/os_win.c 77d39873836f1831a9b0b91894fec45ab0e9ca8e067dc8c549e1d1eca1566fe9
|
||||
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
|
||||
F src/pager.c bc10c191d18bffd3d76eda5f162799e43a9f875ecfe7c4869f752e2ddef87ea2
|
||||
@ -1933,7 +1933,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 7f42b8e1a25c0830fe81e4668318998af595826784a50780a5c1c0b4d95a2482
|
||||
R 7fc4ecd1448b6305c428d5164e326f71
|
||||
U drh
|
||||
Z 3efafb7c09c67bd8bd80d6c3aff384ef
|
||||
P 90b06b6f42918852cfb15258be462c6bed260c6a618b86fa9084bac72fa2f58f
|
||||
R 05a833efc38b4a3220b81b2f3a5823e3
|
||||
U dan
|
||||
Z fc95c03200d563c04629cc3672f249c7
|
||||
|
@ -1 +1 @@
|
||||
90b06b6f42918852cfb15258be462c6bed260c6a618b86fa9084bac72fa2f58f
|
||||
95806ac1dabe4598170061d903ae30f09bafac149ff6696963a7e056ac846cdb
|
@ -5798,25 +5798,35 @@ static int fillInUnixFile(
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Directories to consider for temp files.
|
||||
*/
|
||||
static const char *azTempDirs[] = {
|
||||
0,
|
||||
0,
|
||||
"/var/tmp",
|
||||
"/usr/tmp",
|
||||
"/tmp",
|
||||
"."
|
||||
};
|
||||
|
||||
/*
|
||||
** Initialize first two members of azTempDirs[] array.
|
||||
*/
|
||||
static void unixTempFileInit(void){
|
||||
azTempDirs[0] = getenv("SQLITE_TMPDIR");
|
||||
azTempDirs[1] = getenv("TMPDIR");
|
||||
}
|
||||
|
||||
/*
|
||||
** Return the name of a directory in which to put temporary files.
|
||||
** If no suitable temporary file directory can be found, return NULL.
|
||||
*/
|
||||
static const char *unixTempFileDir(void){
|
||||
static const char *azDirs[] = {
|
||||
0,
|
||||
0,
|
||||
"/var/tmp",
|
||||
"/usr/tmp",
|
||||
"/tmp",
|
||||
"."
|
||||
};
|
||||
unsigned int i = 0;
|
||||
struct stat buf;
|
||||
const char *zDir = sqlite3_temp_directory;
|
||||
|
||||
if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR");
|
||||
if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR");
|
||||
while(1){
|
||||
if( zDir!=0
|
||||
&& osStat(zDir, &buf)==0
|
||||
@ -5825,8 +5835,8 @@ static const char *unixTempFileDir(void){
|
||||
){
|
||||
return zDir;
|
||||
}
|
||||
if( i>=sizeof(azDirs)/sizeof(azDirs[0]) ) break;
|
||||
zDir = azDirs[i++];
|
||||
if( i>=sizeof(azTempDirs)/sizeof(azTempDirs[0]) ) break;
|
||||
zDir = azTempDirs[i++];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -8098,6 +8108,9 @@ int sqlite3_os_init(void){
|
||||
assert( UNIX_SHM_DMS==128 ); /* Byte offset of the deadman-switch */
|
||||
#endif
|
||||
|
||||
/* Initialize temp file dir array. */
|
||||
unixTempFileInit();
|
||||
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user