Index: src/test_windirent.c ================================================================== --- src/test_windirent.c +++ src/test_windirent.c @@ -61,24 +61,32 @@ /* TODO: Remove this if Unix-style root paths are not used. */ if( sqlite3_stricmp(dirname, "/")==0 ){ dirname = windirent_getenv("SystemDrive"); } + memset(&data, 0, sizeof(struct _finddata_t)); _snprintf(data.name, namesize, "%s\\*", dirname); dirp->d_handle = _findfirst(data.name, &data); if( dirp->d_handle==BAD_INTPTR_T ){ closedir(dirp); return NULL; } - /* TODO: Remove this block to allow hidden and system files. */ + /* TODO: Remove this block to allow hidden and/or system files. */ if( data.attrib&_A_HIDDEN || data.attrib&_A_SYSTEM ){ +next: + + memset(&data, 0, sizeof(struct _finddata_t)); if( _findnext(dirp->d_handle, &data)==-1 ){ closedir(dirp); return NULL; } + + /* TODO: Remove this block to allow hidden and/or system files. */ + if( data.attrib&_A_HIDDEN ) goto next; + if( data.attrib&_A_SYSTEM ) goto next; } dirp->d_first.d_attributes = data.attrib; strncpy(dirp->d_first.d_name, data.name, NAME_MAX); dirp->d_first.d_name[NAME_MAX] = '\0'; @@ -103,13 +111,14 @@ return &dirp->d_first; } next: + memset(&data, 0, sizeof(struct _finddata_t)); if( _findnext(dirp->d_handle, &data)==-1 ) return NULL; - /* TODO: Remove this block to allow hidden and system files. */ + /* TODO: Remove this block to allow hidden and/or system files. */ if( data.attrib&_A_HIDDEN ) goto next; if( data.attrib&_A_SYSTEM ) goto next; dirp->d_next.d_ino++; dirp->d_next.d_attributes = data.attrib; @@ -144,16 +153,17 @@ return 0; } next: + memset(&data, 0, sizeof(struct _finddata_t)); if( _findnext(dirp->d_handle, &data)==-1 ){ *result = NULL; return ENOENT; } - /* TODO: Remove this block to allow hidden and system files. */ + /* TODO: Remove this block to allow hidden and/or system files. */ if( data.attrib&_A_HIDDEN ) goto next; if( data.attrib&_A_SYSTEM ) goto next; entry->d_ino = (ino_t)-1; /* not available */ entry->d_attributes = data.attrib;