[PATCH v2 026/113] fs: fix unreaddir, so readdir returns unread dirent first

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Mar 4 10:59:11 PST 2024


unreaddir should return a directory entry at the top of the list, so
readdir consumes it again, not at the end.

Fixes: 7876018f7333 ("fs: implement unreaddir")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 fs/fs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fs.c b/fs/fs.c
index b3eac2e55ad6..bd2f0b6294ff 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1024,7 +1024,7 @@ int unreaddir(DIR *dir, const struct dirent *d)
 
 	entry = xzalloc(sizeof(*entry));
 	entry->d = *d;
-	list_add_tail(&entry->list, &dir->entries);
+	list_add(&entry->list, &dir->entries);
 
 	return 0;
 }
-- 
2.39.2




More information about the barebox mailing list