/ Check-in [32b5c20e]
Login

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

Overview
Comment:On Windows, when no temporary path is available, skip prepending the directory separator.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | winrt
Files: files | file ages | folders
SHA1: 32b5c20e54474fcc33ba937293e97566a555e733
User & Date: mistachkin 2012-03-18 03:22:44
Context
2012-03-19
23:28
Fix typo, use the syscall table for osOutputDebugStringA. check-in: 9598c2a3 user: mistachkin tags: winrt
2012-03-18
03:22
On Windows, when no temporary path is available, skip prepending the directory separator. check-in: 32b5c20e user: mistachkin tags: winrt
01:32
Add SQLITE_OMIT_SHUTDOWN_DIRECTORIES compile-time option to disable clearing the sqlite3_data_directory and sqlite3_temp_directory variables during sqlite3_shutdown. Also, only clear the variables if the heap was actually shutdown. check-in: 1ae9f9e4 user: mistachkin tags: winrt
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

  3303   3303   */
  3304   3304   static int getTempname(int nBuf, char *zBuf){
  3305   3305     static char zChars[] =
  3306   3306       "abcdefghijklmnopqrstuvwxyz"
  3307   3307       "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  3308   3308       "0123456789";
  3309   3309     size_t i, j;
         3310  +  int nTempPath;
  3310   3311     char zTempPath[MAX_PATH+2];
  3311   3312   
  3312   3313     /* It's odd to simulate an io-error here, but really this is just
  3313   3314     ** using the io-error infrastructure to test that SQLite handles this
  3314   3315     ** function failing. 
  3315   3316     */
  3316   3317     SimulateIOError( return SQLITE_IOERR );
................................................................................
  3348   3349     }
  3349   3350   #endif
  3350   3351   #endif
  3351   3352   
  3352   3353     /* Check that the output buffer is large enough for the temporary file 
  3353   3354     ** name. If it is not, return SQLITE_ERROR.
  3354   3355     */
  3355         -  if( (sqlite3Strlen30(zTempPath) + sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX) + 18) >= nBuf ){
         3356  +  nTempPath = sqlite3Strlen30(zTempPath);
         3357  +
         3358  +  if( (nTempPath + sqlite3Strlen30(SQLITE_TEMP_FILE_PREFIX) + 18) >= nBuf ){
  3356   3359       return SQLITE_ERROR;
  3357   3360     }
  3358   3361   
  3359         -  for(i=sqlite3Strlen30(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){}
         3362  +  for(i=nTempPath; i>0 && zTempPath[i-1]=='\\'; i--){}
  3360   3363     zTempPath[i] = 0;
  3361   3364   
  3362         -  sqlite3_snprintf(nBuf-18, zBuf,
  3363         -                   "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath);
         3365  +  sqlite3_snprintf(nBuf-18, zBuf, (nTempPath > 0) ?
         3366  +                       "%s\\"SQLITE_TEMP_FILE_PREFIX : SQLITE_TEMP_FILE_PREFIX,
         3367  +                   zTempPath);
  3364   3368     j = sqlite3Strlen30(zBuf);
  3365   3369     sqlite3_randomness(15, &zBuf[j]);
  3366   3370     for(i=0; i<15; i++, j++){
  3367   3371       zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
  3368   3372     }
  3369   3373     zBuf[j] = 0;
  3370   3374     zBuf[j+1] = 0;