summaryrefslogtreecommitdiff
path: root/dln_find.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-24 10:56:28 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-24 10:56:28 (GMT)
commitad3b5d63764adb6985d073c1b57c6836b30755f4 (patch)
tree14a66cec336b2da011c9fb2ab4b84d4249dec827 /dln_find.c
parent26d0a2a3d672b9016fdb7b45eeed05e3432fd8e4 (diff)
dln_find.c: regular files only
* dln_find.c (dln_find_1): search regular files only. based on the patch by Alex Coomans in [ruby-core:67766]. [Bug #10776] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dln_find.c')
-rw-r--r--dln_find.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/dln_find.c b/dln_find.c
index 56a1981..74beddd 100644
--- a/dln_find.c
+++ b/dln_find.c
@@ -278,11 +278,10 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
}
#endif /* _WIN32 or __EMX__ */
- if (stat(fbuf, &st) == 0) {
+ if (stat(fbuf, &st) == 0 && !S_ISDIR(st.st_mode)) {
if (exe_flag == 0) return fbuf;
/* looking for executable */
- if (!S_ISDIR(st.st_mode) && eaccess(fbuf, X_OK) == 0)
- return fbuf;
+ if (eaccess(fbuf, X_OK) == 0) return fbuf;
}
next:
/* if not, and no other alternatives, life is bleak */