From: Evan Cheng Date: Thu, 7 Oct 2010 22:05:57 +0000 (+0000) Subject: Correctly check if a path is a directory. Fix by Brian Korver. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=a98111cf15bdb2cf06361dfd92afb3d2d0a3b8d8;p=oota-llvm.git 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 --- 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