From f4fb09403ea74ba82c78a28124039beed18cf932 Mon Sep 17 00:00:00 2001 From: Theodore Dubois Date: Sat, 25 Jun 2022 15:22:00 -0700 Subject: [PATCH] Don't drop the last directory entry in fakefs readdir if the buffer is full --- linux/fakefs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/fakefs.c b/linux/fakefs.c index cf15eb0b..3f4a2fe9 100644 --- a/linux/fakefs.c +++ b/linux/fakefs.c @@ -406,7 +406,6 @@ static int fakefs_iterate(struct file *file, struct dir_context *ctx) { res = host_readdir(dir, &ent); if (res <= 0) break; - ctx->pos = host_telldir(dir) + 1; // Get the inode number by constructing the file path and looking it up in the database if (strcmp(ent.name, ".") == 0) { ent.ino = file->f_inode->i_ino; @@ -423,6 +422,7 @@ static int fakefs_iterate(struct file *file, struct dir_context *ctx) { } if (!dir_emit(ctx, ent.name, strlen(ent.name), ent.ino, ent.type)) break; + ctx->pos = host_telldir(dir) + 1; } return res; }