From 3b0d7fb26ec06be16bc7581f82e57e8cef5c906b Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Sun, 30 Oct 2022 22:27:33 -0400 Subject: [PATCH] Fix setting of stat vars for symlinkify --- src/fuse_getattr.cpp | 2 +- src/symlinkify.hpp | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/fuse_getattr.cpp b/src/fuse_getattr.cpp index e7431be3..13b5ccbd 100644 --- a/src/fuse_getattr.cpp +++ b/src/fuse_getattr.cpp @@ -139,7 +139,7 @@ namespace l return -errno; if(symlinkify_ && symlinkify::can_be_symlink(*st_,symlinkify_timeout_)) - st_->st_mode = symlinkify::convert(st_->st_mode); + symlinkify::convert(fullpath,st_); fs::inode::calc(fusepath_,st_); diff --git a/src/symlinkify.hpp b/src/symlinkify.hpp index 628e1725..5f81effa 100644 --- a/src/symlinkify.hpp +++ b/src/symlinkify.hpp @@ -21,6 +21,9 @@ #include #include +#include + + namespace symlinkify { static @@ -41,9 +44,12 @@ namespace symlinkify static inline - mode_t - convert(const mode_t mode_) + void + convert(const std::string &target_, + struct stat *st_) { - return ((mode_ & ~S_IFMT) | S_IFLNK); + st_->st_mode = (((st_->st_mode & ~S_IFMT) | S_IFLNK) | 0777); + st_->st_size = target_.size(); + st_->st_blocks = 0; } }