fix handling of symlink resolved path
This commit is contained in:
@@ -383,9 +383,16 @@ public:
|
|||||||
// God should've smitten me before I wrote such attrocities.
|
// God should've smitten me before I wrote such attrocities.
|
||||||
char* line;
|
char* line;
|
||||||
fs::perms fperms = fs::symlink_status(p).permissions();
|
fs::perms fperms = fs::symlink_status(p).permissions();
|
||||||
bool is_link = S_ISLNK(fstat.st_mode);
|
|
||||||
std::string link_path;
|
// Handle symlink info along with special cases
|
||||||
if (is_link) link_path = fs::read_symlink(p).lexically_relative(root).string();
|
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(
|
asprintf(
|
||||||
&line,
|
&line,
|
||||||
"%c%c%c%c%c%c%c%c%c%c %4u %4u %4u %12u %s %s%s\r\n",
|
"%c%c%c%c%c%c%c%c%c%c %4u %4u %4u %12u %s %s%s\r\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user