/ Check-in [26dd42b4]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix handling of initial hidden and/or system files in the opendir() implementation for Windows. No changes to non-test code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 26dd42b462dc621b8b0a2295fc91d3e61ac732b6
User & Date: mistachkin 2017-01-18 22:16:20
Context
2017-01-18
22:16
Make the vtabH-3.1 test more portable and robust. check-in: d3c91c1f user: mistachkin tags: trunk
22:16
Fix handling of initial hidden and/or system files in the opendir() implementation for Windows. No changes to non-test code. check-in: 26dd42b4 user: mistachkin tags: trunk
2017-01-17
10:41
Fix a problem that could cause a spurious SQLITE_NOMEM error when attempting to resume an RBU operation if the previous client failed right after completing the incremental checkpoint. Also a "cannot vacuum wal db" error that could occur when resuming an RBU vacuum if an error (OOM or IO error) occurs during the incremental checkpoint. check-in: 681d96eb user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_windirent.c.

    59     59     memset(dirp, 0, sizeof(DIR));
    60     60   
    61     61     /* TODO: Remove this if Unix-style root paths are not used. */
    62     62     if( sqlite3_stricmp(dirname, "/")==0 ){
    63     63       dirname = windirent_getenv("SystemDrive");
    64     64     }
    65     65   
           66  +  memset(&data, 0, sizeof(struct _finddata_t));
    66     67     _snprintf(data.name, namesize, "%s\\*", dirname);
    67     68     dirp->d_handle = _findfirst(data.name, &data);
    68     69   
    69     70     if( dirp->d_handle==BAD_INTPTR_T ){
    70     71       closedir(dirp);
    71     72       return NULL;
    72     73     }
    73     74   
    74         -  /* TODO: Remove this block to allow hidden and system files. */
           75  +  /* TODO: Remove this block to allow hidden and/or system files. */
    75     76     if( data.attrib&_A_HIDDEN || data.attrib&_A_SYSTEM ){
           77  +next:
           78  +
           79  +    memset(&data, 0, sizeof(struct _finddata_t));
    76     80       if( _findnext(dirp->d_handle, &data)==-1 ){
    77     81         closedir(dirp);
    78     82         return NULL;
    79     83       }
           84  +
           85  +    /* TODO: Remove this block to allow hidden and/or system files. */
           86  +    if( data.attrib&_A_HIDDEN ) goto next;
           87  +    if( data.attrib&_A_SYSTEM ) goto next;
    80     88     }
    81     89   
    82     90     dirp->d_first.d_attributes = data.attrib;
    83     91     strncpy(dirp->d_first.d_name, data.name, NAME_MAX);
    84     92     dirp->d_first.d_name[NAME_MAX] = '\0';
    85     93   
    86     94     return dirp;
................................................................................
   101    109       dirp->d_next.d_ino++;
   102    110   
   103    111       return &dirp->d_first;
   104    112     }
   105    113   
   106    114   next:
   107    115   
          116  +  memset(&data, 0, sizeof(struct _finddata_t));
   108    117     if( _findnext(dirp->d_handle, &data)==-1 ) return NULL;
   109    118   
   110         -  /* TODO: Remove this block to allow hidden and system files. */
          119  +  /* TODO: Remove this block to allow hidden and/or system files. */
   111    120     if( data.attrib&_A_HIDDEN ) goto next;
   112    121     if( data.attrib&_A_SYSTEM ) goto next;
   113    122   
   114    123     dirp->d_next.d_ino++;
   115    124     dirp->d_next.d_attributes = data.attrib;
   116    125     strncpy(dirp->d_next.d_name, data.name, NAME_MAX);
   117    126     dirp->d_next.d_name[NAME_MAX] = '\0';
................................................................................
   142    151   
   143    152       *result = entry;
   144    153       return 0;
   145    154     }
   146    155   
   147    156   next:
   148    157   
          158  +  memset(&data, 0, sizeof(struct _finddata_t));
   149    159     if( _findnext(dirp->d_handle, &data)==-1 ){
   150    160       *result = NULL;
   151    161       return ENOENT;
   152    162     }
   153    163   
   154         -  /* TODO: Remove this block to allow hidden and system files. */
          164  +  /* TODO: Remove this block to allow hidden and/or system files. */
   155    165     if( data.attrib&_A_HIDDEN ) goto next;
   156    166     if( data.attrib&_A_SYSTEM ) goto next;
   157    167   
   158    168     entry->d_ino = (ino_t)-1; /* not available */
   159    169     entry->d_attributes = data.attrib;
   160    170     strncpy(entry->d_name, data.name, NAME_MAX);
   161    171     entry->d_name[NAME_MAX] = '\0';