aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2005-04-20 15:33:22 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2005-04-20 15:33:22 +0000
commit8177bf8904be3906781e66e41980d01dc7ce1bbe (patch)
tree38a797eab798e6195016e4d80ce876ea1aff942b
parentbaec07cbfec59d379a91dd9296a357263121e5af (diff)
Do not mark directories as `executable', we only want program files
Patch by Markus Oberhumer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21377 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/System/Unix/Path.inc4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc
index e55d9edcf2..ce0e49127e 100644
--- a/lib/System/Unix/Path.inc
+++ b/lib/System/Unix/Path.inc
@@ -311,6 +311,10 @@ Path::writable() const {
bool
Path::executable() const {
+ struct stat st;
+ int r = stat(path.c_str(), &st);
+ if (r != 0 || !S_ISREG(st.st_mode))
+ return false;
return 0 == access(path.c_str(), R_OK | X_OK );
}