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
This commit is contained in:
@@ -399,7 +399,7 @@ normalize_dir_path(const char *path, string &normalizedPath)
|
|||||||
{
|
{
|
||||||
// stat() the dir
|
// stat() the dir
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (lstat(path, &st) < 0)
|
if (stat(path, &st) < 0)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
return normalize_dir_path(path, NodeRef(st), normalizedPath);
|
return normalize_dir_path(path, NodeRef(st), normalizedPath);
|
||||||
@@ -617,11 +617,15 @@ open_dir(const char *path)
|
|||||||
|
|
||||||
// stat the entry
|
// stat the entry
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (lstat(path, &st) < 0)
|
if (stat(path, &st) < 0) {
|
||||||
|
closedir(dir);
|
||||||
return errno;
|
return errno;
|
||||||
|
}
|
||||||
|
|
||||||
if (!S_ISDIR(st.st_mode))
|
if (!S_ISDIR(st.st_mode)) {
|
||||||
|
closedir(dir);
|
||||||
return B_NOT_A_DIRECTORY;
|
return B_NOT_A_DIRECTORY;
|
||||||
|
}
|
||||||
|
|
||||||
// cache dir path
|
// cache dir path
|
||||||
NodeRef ref(st);
|
NodeRef ref(st);
|
||||||
@@ -670,7 +674,7 @@ _kern_open_parent_dir(int fd, char *name, size_t nameLength)
|
|||||||
|
|
||||||
// stat the entry
|
// stat the entry
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (lstat(realPath.c_str(), &st) < 0)
|
if (stat(realPath.c_str(), &st) < 0)
|
||||||
return errno;
|
return errno;
|
||||||
|
|
||||||
if (!S_ISDIR(st.st_mode))
|
if (!S_ISDIR(st.st_mode))
|
||||||
|
|||||||
Reference in New Issue
Block a user