From 075d1821a22ea07dd5b5342a8f27bcf4f5ea7117 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Sun, 29 Jan 2017 12:44:18 -0800 Subject: [PATCH] tst: passthrough-fuse: windows-posix layer --- tst/passthrough-fuse/passthrough-fuse.c | 1 + tst/passthrough-fuse/winposix.c | 6 ++++++ tst/passthrough-fuse/winposix.h | 1 + 3 files changed, 8 insertions(+) diff --git a/tst/passthrough-fuse/passthrough-fuse.c b/tst/passthrough-fuse/passthrough-fuse.c index f103b3fa..d3a725dd 100644 --- a/tst/passthrough-fuse/passthrough-fuse.c +++ b/tst/passthrough-fuse/passthrough-fuse.c @@ -171,6 +171,7 @@ static int ptfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, fus DIR *dirp = (DIR *)fi->fh; struct dirent *de; + rewinddir(dirp); for (;;) { errno = 0; diff --git a/tst/passthrough-fuse/winposix.c b/tst/passthrough-fuse/winposix.c index 2e27ff2e..a9f7709a 100644 --- a/tst/passthrough-fuse/winposix.c +++ b/tst/passthrough-fuse/winposix.c @@ -355,6 +355,12 @@ DIR *opendir(const char *path) return dirp; } +void rewinddir(DIR *dirp) +{ + if (INVALID_HANDLE_VALUE != dirp->handle) + FindClose(dirp->handle); +} + struct dirent *readdir(DIR *dirp) { WIN32_FIND_DATAA FindData; diff --git a/tst/passthrough-fuse/winposix.h b/tst/passthrough-fuse/winposix.h index e8080310..ff34ce65 100644 --- a/tst/passthrough-fuse/winposix.h +++ b/tst/passthrough-fuse/winposix.h @@ -58,6 +58,7 @@ int mkdir(const char *path, fuse_mode_t mode); int rmdir(const char *path); DIR *opendir(const char *path); +void rewinddir(DIR *dirp); struct dirent *readdir(DIR *dirp); int closedir(DIR *dirp);