diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/test_windirent.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/test_windirent.c b/src/test_windirent.c index 044bc7f41..450e4c3cc 100644 --- a/src/test_windirent.c +++ b/src/test_windirent.c @@ -63,6 +63,7 @@ LPDIR opendir( dirname = windirent_getenv("SystemDrive"); } + memset(&data, 0, sizeof(struct _finddata_t)); _snprintf(data.name, namesize, "%s\\*", dirname); dirp->d_handle = _findfirst(data.name, &data); @@ -71,12 +72,19 @@ LPDIR opendir( 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; @@ -105,9 +113,10 @@ LPDIRENT readdir( 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; @@ -146,12 +155,13 @@ INT readdir_r( 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; |