mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-14 08:50:53 +00:00
Merge branch 'fix-broken-symlink-reading' into 'next'
Fix addon loading issues with symlinks on Linux/*BSD See merge request STJr/SRB2!2331
This commit is contained in:
commit
dd0640e8ac
1 changed files with 2 additions and 3 deletions
|
@ -444,12 +444,11 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
|
||||||
strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name);
|
strcpy(&searchpath[searchpathindex[depthleft]],dent->d_name);
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__FreeBSD__)
|
#if defined(__linux__) || defined(__FreeBSD__)
|
||||||
if (dent->d_type == DT_UNKNOWN)
|
if (dent->d_type == DT_UNKNOWN || dent->d_type == DT_LNK)
|
||||||
if (lstat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode))
|
if (stat(searchpath,&fsstat) == 0 && S_ISDIR(fsstat.st_mode))
|
||||||
dent->d_type = DT_DIR;
|
dent->d_type = DT_DIR;
|
||||||
|
|
||||||
// Linux and FreeBSD has a special field for file type on dirent, so use that to speed up lookups.
|
// 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)
|
if (dent->d_type == DT_DIR && depthleft)
|
||||||
#else
|
#else
|
||||||
if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
|
if (stat(searchpath,&fsstat) < 0) // do we want to follow symlinks? if not: change it to lstat
|
||||||
|
|
Loading…
Reference in a new issue