aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-12-04 13:02:00 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-12-04 13:02:00 +0200
commit520200d5978e4a870d9cbd8a7b71883e4329711b (patch)
tree791aec1a68f3d9f12c1cf3e76afa3d90ca5335ab /src
parentab67985d21ddac57591ec7a5062c323e7dfbdc32 (diff)
downloadminetest-520200d5978e4a870d9cbd8a7b71883e4329711b.tar.gz
minetest-520200d5978e4a870d9cbd8a7b71883e4329711b.tar.bz2
minetest-520200d5978e4a870d9cbd8a7b71883e4329711b.zip
Check symlinks with stat() to know if they are directories or not
Diffstat (limited to 'src')
-rw-r--r--src/filesys.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/filesys.cpp b/src/filesys.cpp
index 4a01becbf..a65515d03 100644
--- a/src/filesys.cpp
+++ b/src/filesys.cpp
@@ -196,18 +196,19 @@ std::vector<DirListNode> GetDirListing(std::string pathstring)
int isdir = -1; // -1 means unknown
/*
- POSIX doesn't define d_type member of
- struct dirent and certain filesystems on
- glibc/Linux will only return DT_UNKNOWN for
- the d_type member.
+ POSIX doesn't define d_type member of struct dirent and
+ certain filesystems on glibc/Linux will only return
+ DT_UNKNOWN for the d_type member.
+
+ Also we don't know whether symlinks are directories or not.
*/
#ifdef _DIRENT_HAVE_D_TYPE
- if(dirp->d_type != DT_UNKNOWN)
+ if(dirp->d_type != DT_UNKNOWN && dirp->d_type != DT_LNK)
isdir = (dirp->d_type == DT_DIR);
#endif /* _DIRENT_HAVE_D_TYPE */
/*
- Was d_type DT_UNKNOWN (or nonexistent)?
+ Was d_type DT_UNKNOWN, DT_LNK or nonexistent?
If so, try stat().
*/
if(isdir == -1)