fix handling of symlink resolved path

This commit is contained in:
2025-01-01 19:28:45 -06:00
parent 478b0db66c
commit 446e5163ad

View File

@@ -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",