diff --git a/tst/passthrough-fuse/passthrough-fuse.c b/tst/passthrough-fuse/passthrough-fuse.c index 479b4e7c..c8ae9409 100644 --- a/tst/passthrough-fuse/passthrough-fuse.c +++ b/tst/passthrough-fuse/passthrough-fuse.c @@ -198,8 +198,7 @@ static int ptfs_releasedir(const char *path, struct fuse_file_info *fi) { DIR *dirp = fi_dirp(fi); - closedir(dirp); - return 0; + return -1 != closedir(dirp) ? 0 : -errno; } static int ptfs_create(const char *path, fuse_mode_t mode, struct fuse_file_info *fi) diff --git a/tst/passthrough-fuse/winposix.c b/tst/passthrough-fuse/winposix.c index 50803bc1..29ec5094 100644 --- a/tst/passthrough-fuse/winposix.c +++ b/tst/passthrough-fuse/winposix.c @@ -32,7 +32,7 @@ struct _DIR { HANDLE h, fh; - struct dirent dirent; + struct dirent de; char path[]; }; @@ -384,12 +384,16 @@ struct dirent *readdir(DIR *dirp) else { if (!FindNextFileA(dirp->fh, &FindData)) + { + if (ERROR_NO_MORE_FILES == GetLastError()) + return 0; return error0(); + } } - strcpy(dirp->dirent.d_name, FindData.cFileName); + strcpy(dirp->de.d_name, FindData.cFileName); - return &dirp->dirent; + return &dirp->de; } int closedir(DIR *dirp)