/ Check-in [03875633]
Login

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

Overview
Comment:Do not do the AV retry loop on open if the file that is attempting to be opened is really a directory.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | win-check-dir
Files: files | file ages | folders
SHA1: 03875633f465e82fbe99829f96db25f6d32bd333
User & Date: drh 2012-05-07 13:15:20
Context
2012-05-07
17:16
Simplify directory checking for winOpen and add checking to winDelete. Closed-Leaf check-in: b08530e1 user: mistachkin tags: win-check-dir
13:15
Do not do the AV retry loop on open if the file that is attempting to be opened is really a directory. check-in: 03875633 user: drh tags: win-check-dir
2012-05-01
14:21
Update a test in io.test to account for [05f98d4eec]. check-in: bfa61e78 user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

3026
3027
3028
3029
3030
3031
3032























3033
3034
3035
3036
3037
3038
3039
....
3181
3182
3183
3184
3185
3186
3187
3188

3189
3190
3191
3192
3193

3194
3195
3196
3197
3198
3199
3200
  }
  zBuf[j] = 0;
  zBuf[j+1] = 0;

  OSTRACE(("TEMP FILENAME: %s\n", zBuf));
  return SQLITE_OK; 
}
























/*
** Open a file.
*/
static int winOpen(
  sqlite3_vfs *pVfs,        /* Not used */
  const char *zName,        /* Name of the file (UTF-8) */
................................................................................

  if( isNT() ){
    while( (h = osCreateFileW((LPCWSTR)zConverted,
                              dwDesiredAccess,
                              dwShareMode, NULL,
                              dwCreationDisposition,
                              dwFlagsAndAttributes,
                              NULL))==INVALID_HANDLE_VALUE &&

                              retryIoerr(&cnt, &lastErrno) ){}
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed. 
** Since the ANSI version of these Windows API do not exist for WINCE,
** it's important to not reference them for WINCE builds.
*/

#if SQLITE_OS_WINCE==0
  }else{
    while( (h = osCreateFileA((LPCSTR)zConverted,
                              dwDesiredAccess,
                              dwShareMode, NULL,
                              dwCreationDisposition,
                              dwFlagsAndAttributes,







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
>
|
<
|
<
<
>







3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
....
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213

3214


3215
3216
3217
3218
3219
3220
3221
3222
  }
  zBuf[j] = 0;
  zBuf[j+1] = 0;

  OSTRACE(("TEMP FILENAME: %s\n", zBuf));
  return SQLITE_OK; 
}

/* Forward reference */
static int winAccess(sqlite3_vfs*,const char*,int,int*);

/*
** Return TRUE if the named file is really a directory.  Return false if
** it is something other than a directory, or if there is any kind of memory
** allocation failure.
*/
static int winIsDir(sqlite3_vfs *pVfs, const char *zName){
  int isDir = 0;
  int rc;
  char *zDirName;

  zDirName = sqlite3_mprintf("%s/nul", zName);
  if( zDirName ){
    rc = winAccess(pVfs, zDirName, SQLITE_ACCESS_EXISTS, &isDir);
    sqlite3_free(zDirName);
  }else{
    rc = SQLITE_NOMEM;
  }
  return rc==SQLITE_OK && isDir;
}

/*
** Open a file.
*/
static int winOpen(
  sqlite3_vfs *pVfs,        /* Not used */
  const char *zName,        /* Name of the file (UTF-8) */
................................................................................

  if( isNT() ){
    while( (h = osCreateFileW((LPCWSTR)zConverted,
                              dwDesiredAccess,
                              dwShareMode, NULL,
                              dwCreationDisposition,
                              dwFlagsAndAttributes,
                              NULL))==INVALID_HANDLE_VALUE
        && !winIsDir(pVfs, zName)
        && retryIoerr(&cnt, &lastErrno) ){

               /* Noop */


    }
#if SQLITE_OS_WINCE==0
  }else{
    while( (h = osCreateFileA((LPCSTR)zConverted,
                              dwDesiredAccess,
                              dwShareMode, NULL,
                              dwCreationDisposition,
                              dwFlagsAndAttributes,