Skip to content

Commit

Permalink
Backport Core fix
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-manias authored Jan 6, 2025
2 parents f777017 + 4186f0e commit c55a5d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/core/classes/class_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,11 @@ static ERR FILE_Init(extFile *Self)
#ifdef __unix__
// Establishing whether or not the path is a link is required on initialisation.
struct stat64 info;
if (Self->prvResolvedPath.ends_with('/')) Self->prvResolvedPath.pop_back(); // For lstat64() symlink we need to remove the slash
if (lstat64(Self->prvResolvedPath.c_str(), &info) != -1) { // Prefer to get a stat on the link rather than the file it refers to
if (S_ISLNK(info.st_mode)) Self->Flags |= FL::LINK;
if (Self->prvResolvedPath != "/") {
if (Self->prvResolvedPath.ends_with('/')) Self->prvResolvedPath.pop_back(); // For lstat64() symlink we need to remove the slash
if (lstat64(Self->prvResolvedPath.c_str(), &info) != -1) { // Prefer to get a stat on the link rather than the file it refers to
if (S_ISLNK(info.st_mode)) Self->Flags |= FL::LINK;
}
}
#endif

Expand Down

0 comments on commit c55a5d0

Please sign in to comment.