From 21fab6b208781d9bc6627258a32f50933d1cd901 Mon Sep 17 00:00:00 2001 From: m4rkusxxl Date: Fri, 19 Jan 2018 09:44:43 +0300 Subject: [PATCH] Fix searching for free slots in the root directory. When we need to place n entries and slot at position x is occupied, we should check x+1 instead of jumping to x+n. Otherwise we may end up putting new entries beyond a 0x00 entry, which Windows 10 interprets as an end-of-directory mark and does not look farther. --- libexfat/node.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libexfat/node.c b/libexfat/node.c index b544bd9..2ba2313 100644 --- a/libexfat/node.c +++ b/libexfat/node.c @@ -855,7 +855,8 @@ static int find_slot(struct exfat* ef, struct exfat_node* dir, free(dmap); return -EIO; case -EINVAL: - /* slot is occupied, continue searching */ + /* slot at (i-n) is occupied, go back and check (i-n+1) */ + i -= contiguous - 1; contiguous = 0; break; } -- 2.11.0