/ Check-in [96aa96ac]
Login

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

Overview
Comment:Fix temp file handling for OS/2 so that trailing slashes or backslashes are stripped off the path gotten from the environment. Otherwise full paths might contain multiple slashes which causes opening of files to fail. (CVS 4406)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 96aa96ac11ab63b51e4322e88ded4f931e1e78c8
User & Date: pweilbacher 2007-09-05 22:28:23
Context
2007-09-06
07:47
Add some extra comments to the header in test_async.c. (CVS 4407) check-in: 79cf4e88 user: danielk1977 tags: trunk
2007-09-05
22:28
Fix temp file handling for OS/2 so that trailing slashes or backslashes are stripped off the path gotten from the environment. Otherwise full paths might contain multiple slashes which causes opening of files to fail. (CVS 4406) check-in: 96aa96ac user: pweilbacher tags: trunk
17:06
Fix a harmless typo in the PRNG initialization on win32. Ticket #2617. (CVS 4405) check-in: ea1d76e3 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_os2.c.

   234    234         if( DosScanEnv( (PSZ)"TMPDIR", &zTempPath ) ){
   235    235              ULONG ulDriveNum = 0, ulDriveMap = 0;
   236    236              DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
   237    237              sprintf( (char*)zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) );
   238    238         }
   239    239       }
   240    240     }
          241  +  /* strip off a trailing slashes or backslashes, otherwise we would get *
          242  +   * multiple (back)slashes which causes DosOpen() to fail               */
          243  +  j = strlen(zTempPath);
          244  +  while( j > 0 && zTempPath[j-1] == '\\' || zTempPath[j-1] == '/' ){
          245  +      j--;
          246  +  }
          247  +  zTempPath[j] = '\0';
   241    248     for(;;){
   242    249         sprintf( zBuf, "%s\\"TEMP_FILE_PREFIX, zTempPath );
   243    250         j = strlen( zBuf );
   244    251         sqlite3Randomness( 15, &zBuf[j] );
   245    252         for( i = 0; i < 15; i++, j++ ){
   246    253           zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
   247    254         }