From a98111cf15bdb2cf06361dfd92afb3d2d0a3b8d8 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Thu, 7 Oct 2010 22:05:57 +0000 Subject: [PATCH] Correctly check if a path is a directory. Fix by Brian Korver. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115991 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/System/Unix/Path.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index 184da1e27ac..4c97c4b71cc 100644 --- a/lib/System/Unix/Path.inc +++ b/lib/System/Unix/Path.inc @@ -439,7 +439,7 @@ Path::isDirectory() const { struct stat buf; if (0 != stat(path.c_str(), &buf)) return false; - return buf.st_mode & S_IFDIR ? true : false; + return ((buf.st_mode & S_IFMT) == S_IFDIR) ? true : false; } bool