From 446e5163ad5ab2009d8c1dffc0c7e076cef3625b Mon Sep 17 00:00:00 2001 From: Wirlaburla Date: Wed, 1 Jan 2025 19:28:45 -0600 Subject: [PATCH] fix handling of symlink resolved path --- src/plugins/filer_local/filer_local.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/plugins/filer_local/filer_local.cpp b/src/plugins/filer_local/filer_local.cpp index ab18bf4..68bcc36 100644 --- a/src/plugins/filer_local/filer_local.cpp +++ b/src/plugins/filer_local/filer_local.cpp @@ -383,9 +383,16 @@ public: // God should've smitten me before I wrote such attrocities. char* line; fs::perms fperms = fs::symlink_status(p).permissions(); - bool is_link = S_ISLNK(fstat.st_mode); - std::string link_path; - if (is_link) link_path = fs::read_symlink(p).lexically_relative(root).string(); + + // Handle symlink info along with special cases + bool is_link = false; std::string link_path; + if ((is_link = S_ISLNK(fstat.st_mode))) { + fs::path sym_resolved; + if (resolvePath(fs::read_symlink(p), &sym_resolved)) + link_path = sym_resolved.lexically_relative(resolved).string(); + else is_link = false; + } + asprintf( &line, "%c%c%c%c%c%c%c%c%c%c %4u %4u %4u %12u %s %s%s\r\n",