From 487f4ef49fe7c8ff27614393cab85d7ba2d540e9 Mon Sep 17 00:00:00 2001 From: Hanicef <gustaf@hanicef.me> Date: Sat, 17 Feb 2024 10:55:43 +0100 Subject: [PATCH] Fix addon loading issues with symlinks on Linux/*BSD --- src/filesrch.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/filesrch.c b/src/filesrch.c index 6429b6fa2f..734a599b33 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -444,12 +444,11 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name); #if defined(__linux__) || defined(__FreeBSD__) - if (dent->d_type == DT_UNKNOWN) - if (lstat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode)) + if (dent->d_type == DT_UNKNOWN || dent->d_type == DT_LNK) + if (stat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode)) dent->d_type = DT_DIR; // Linux and FreeBSD has a special field for file type on dirent, so use that to speed up lookups. - // FIXME: should we also follow symlinks? if (dent->d_type == DT_DIR && depthleft) #else if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat -- GitLab