From fb6eb1f02802d168f05a794272172b980e8f7576 Mon Sep 17 00:00:00 2001 From: Lanzheng Liu Date: Wed, 21 Feb 2024 12:01:19 +0800 Subject: [PATCH] fix readdir for localfs Signed-off-by: Lanzheng Liu --- fs/localfs.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/localfs.cpp b/fs/localfs.cpp index 2c9dfbc7..e133bfad 100644 --- a/fs/localfs.cpp +++ b/fs/localfs.cpp @@ -294,6 +294,8 @@ namespace fs ::DIR* dirp; ::dirent* direntp; long loc; + ::dirent m_dirent; + LocalDIR(::DIR* dirp) : dirp(dirp) { next(); @@ -313,6 +315,10 @@ namespace fs } virtual dirent* get() override { + if (direntp) { + memcpy(&m_dirent, direntp, sizeof(m_dirent)); + return &m_dirent; + } return direntp; } virtual int next() override