Handle sqlite3_temp_directory on OS/2. (CVS 5379)
FossilOrigin-Name: 9da0b32c8c55b41cbcb4eb635c51348072101ea9
This commit is contained in:
parent
1fc4129df7
commit
96d9cf064b
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Added\smacros\sto\sconvert\sbetween\s32-bit\sints\sand\s64-bit\sptrs\sto\savoid\scompiler\swarnings.\s(CVS\s5378)
|
||||
D 2008-07-08T22:28:49
|
||||
C Handle\ssqlite3_temp_directory\son\sOS/2.\s(CVS\s5379)
|
||||
D 2008-07-08T22:34:07
|
||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||
F Makefile.in a03f7cb4f7ad50bc53a788c6c544430e81f95de4
|
||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||
@ -130,7 +130,7 @@ F src/mutex_w32.c f0d21ff1f6981e5aedc56796adf3a347423ef736
|
||||
F src/os.c 292b3b4a49fe5bf6cf2f1cf0af186ebd334e80b8
|
||||
F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892
|
||||
F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
|
||||
F src/os_os2.c 7ca541fc04fa3be98b1f3d2a5b6d6daa425f8b60
|
||||
F src/os_os2.c 6c33e61f0fab256b0136650cdee35c3eaab2fa04
|
||||
F src/os_unix.c 3d19f0491e0b32e5b757c7e6f310f2f6d3aea3f4
|
||||
F src/os_win.c 2bf2f8cd700299564cc236262c2668e1e02c626a
|
||||
F src/pager.c 2cd554d474cfa0228ece30645fe7bb7d1f6824c7
|
||||
@ -600,7 +600,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
|
||||
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
P bfca089dbfa742c5ba3a530f61b5e979935d127f
|
||||
R 2fd5b0b488f6cefac45207b2dc106528
|
||||
U shane
|
||||
Z 21361f9c1827dc63347e00a7ff2f8aa2
|
||||
P 6cdb6841ff4683e424ef394733da9c24f5602570
|
||||
R 25d8e118bf8ba394bf175259827dc7d9
|
||||
U pweilbacher
|
||||
Z 037a3fab80bbb871bde5db3b3d98709e
|
||||
|
@ -1 +1 @@
|
||||
6cdb6841ff4683e424ef394733da9c24f5602570
|
||||
9da0b32c8c55b41cbcb4eb635c51348072101ea9
|
42
src/os_os2.c
42
src/os_os2.c
@ -12,7 +12,7 @@
|
||||
**
|
||||
** This file contains code that is specific to OS/2.
|
||||
**
|
||||
** $Id: os_os2.c,v 1.48 2008/07/08 19:46:24 pweilbacher Exp $
|
||||
** $Id: os_os2.c,v 1.49 2008/07/08 22:34:07 pweilbacher Exp $
|
||||
*/
|
||||
|
||||
#include "sqliteInt.h"
|
||||
@ -645,27 +645,37 @@ static int getTempname(int nBuf, char *zBuf ){
|
||||
int i, j;
|
||||
char zTempPathBuf[3];
|
||||
PSZ zTempPath = (PSZ)&zTempPathBuf;
|
||||
char *zTempPathUTF;
|
||||
if( DosScanEnv( (PSZ)"TEMP", &zTempPath ) ){
|
||||
if( DosScanEnv( (PSZ)"TMP", &zTempPath ) ){
|
||||
if( DosScanEnv( (PSZ)"TMPDIR", &zTempPath ) ){
|
||||
ULONG ulDriveNum = 0, ulDriveMap = 0;
|
||||
DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
|
||||
sprintf( (char*)zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) );
|
||||
if( sqlite3_temp_directory ){
|
||||
zTempPath = sqlite3_temp_directory;
|
||||
}else{
|
||||
if( DosScanEnv( (PSZ)"TEMP", &zTempPath ) ){
|
||||
if( DosScanEnv( (PSZ)"TMP", &zTempPath ) ){
|
||||
if( DosScanEnv( (PSZ)"TMPDIR", &zTempPath ) ){
|
||||
ULONG ulDriveNum = 0, ulDriveMap = 0;
|
||||
DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
|
||||
sprintf( (char*)zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* strip off a trailing slashes or backslashes, otherwise we would get *
|
||||
* multiple (back)slashes which causes DosOpen() to fail */
|
||||
/* Strip off a trailing slashes or backslashes, otherwise we would get *
|
||||
* multiple (back)slashes which causes DosOpen() to fail. *
|
||||
* Trailing spaces are not allowed, either. */
|
||||
j = strlen(zTempPath);
|
||||
while( j > 0 && ( zTempPath[j-1] == '\\' || zTempPath[j-1] == '/' ) ){
|
||||
while( j > 0 && ( zTempPath[j-1] == '\\' || zTempPath[j-1] == '/'
|
||||
|| zTempPath[j-1] == ' ' ) ){
|
||||
j--;
|
||||
}
|
||||
zTempPath[j] = '\0';
|
||||
zTempPathUTF = convertCpPathToUtf8( zTempPath );
|
||||
sqlite3_snprintf( nBuf-30, zBuf,
|
||||
"%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPathUTF );
|
||||
free( zTempPathUTF );
|
||||
if( !sqlite3_temp_directory ){
|
||||
char *zTempPathUTF = convertCpPathToUtf8( zTempPath );
|
||||
sqlite3_snprintf( nBuf-30, zBuf,
|
||||
"%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPathUTF );
|
||||
free( zTempPathUTF );
|
||||
}else{
|
||||
sqlite3_snprintf( nBuf-30, zBuf,
|
||||
"%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath );
|
||||
}
|
||||
j = strlen( zBuf );
|
||||
sqlite3_randomness( 20, &zBuf[j] );
|
||||
for( i = 0; i < 20; i++, j++ ){
|
||||
@ -772,7 +782,7 @@ static int os2Open(
|
||||
if( rc != NO_ERROR ){
|
||||
OSTRACE7( "OPEN Invalid handle rc=%d: zName=%s, ulAction=%#lx, ulAttr=%#lx, ulFlags=%#lx, ulMode=%#lx\n",
|
||||
rc, zName, ulAction, ulFileAttribute, ulOpenFlags, ulOpenMode );
|
||||
if ( pFile->pathToDel )
|
||||
if( pFile->pathToDel )
|
||||
free( pFile->pathToDel );
|
||||
pFile->pathToDel = NULL;
|
||||
if( flags & SQLITE_OPEN_READWRITE ){
|
||||
|
Loading…
Reference in New Issue
Block a user