From 0d01fcabfcb5a5cda569397295b05882df5763b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Fri, 17 Apr 2015 11:38:33 +0200 Subject: [PATCH] Implemented rewindind a directory in lowntfs-3g Rewinding a directory is done by freeing the current list of files and rebuilding it. Only seeking to the beginning of the list is implemented. --- src/lowntfs-3g.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index 3ff8b9de..9a894df2 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -1171,6 +1171,16 @@ static void ntfs_fuse_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, fill = (ntfs_fuse_fill_context_t*)(long)fi->fh; if (fill && (fill->ino == ino)) { + if (fill->filled && !off) { + /* Rewinding : make sure to clear existing results */ + current = fill->first; + while (current) { + current = current->next; + free(fill->first); + fill->first = current; + } + fill->filled = FALSE; + } if (!fill->filled) { /* initial call : build the full list */ first = (ntfs_fuse_fill_item_t*)ntfs_malloc