Correctly check if a path is a directory. Fix by Brian Korver.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 7 Oct 2010 22:05:57 +0000 (22:05 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 7 Oct 2010 22:05:57 +0000 (22:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115991 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/Unix/Path.inc

index 184da1e27ac0c7a32dd76fc9495952bd7e0fb75e..4c97c4b71ccf96c89e7e3ea8aa7f82ead5b4359a 100644 (file)
@@ -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