From 25b0bc72dfbd96e150bacf1a748901e343e34f8b Mon Sep 17 00:00:00 2001 From: trapexit Date: Tue, 30 Sep 2025 12:25:19 -0400 Subject: [PATCH] Fix dirent64::namelen calculation (#1538) Worked fine on my machine where padding seemed to be all zeroed out but that doesn't appear to be the case elsewhere. Could try https://codeberg.org/jbruchon/libjodycode/src/branch/master/dir.c#L92-L110 but needs to be tested. --- libfuse/include/fs_dirent64.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libfuse/include/fs_dirent64.hpp b/libfuse/include/fs_dirent64.hpp index 54052862..d3dd5fb6 100644 --- a/libfuse/include/fs_dirent64.hpp +++ b/libfuse/include/fs_dirent64.hpp @@ -2,6 +2,7 @@ #include #include +#include namespace fs { @@ -15,9 +16,10 @@ namespace fs char name[]; public: - int namelen() const + size_t + namelen() const { - return (reclen - offsetof(dirent64,name)); + return ::strlen(name); } }; }