From 90b6f0e5fe84249d9243c35673d217beae4e350a Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 13 Nov 2005 17:22:25 +0000 Subject: [PATCH] Replaced a few lstat()s with stat()s where symlinks to directories would be legal. This might even fix the bug that build tools like xres or settype couldn't find an existing file under Linux (was never able to reproduce that one, though). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14900 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/build/libroot/fs.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/build/libroot/fs.cpp b/src/build/libroot/fs.cpp index aea29bc8cc..82a9a1b5ce 100644 --- a/src/build/libroot/fs.cpp +++ b/src/build/libroot/fs.cpp @@ -399,7 +399,7 @@ normalize_dir_path(const char *path, string &normalizedPath) { // stat() the dir struct stat st; - if (lstat(path, &st) < 0) + if (stat(path, &st) < 0) return errno; return normalize_dir_path(path, NodeRef(st), normalizedPath); @@ -617,11 +617,15 @@ open_dir(const char *path) // stat the entry struct stat st; - if (lstat(path, &st) < 0) + if (stat(path, &st) < 0) { + closedir(dir); return errno; + } - if (!S_ISDIR(st.st_mode)) + if (!S_ISDIR(st.st_mode)) { + closedir(dir); return B_NOT_A_DIRECTORY; + } // cache dir path NodeRef ref(st); @@ -670,7 +674,7 @@ _kern_open_parent_dir(int fd, char *name, size_t nameLength) // stat the entry struct stat st; - if (lstat(realPath.c_str(), &st) < 0) + if (stat(realPath.c_str(), &st) < 0) return errno; if (!S_ISDIR(st.st_mode))