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
This commit is contained in:
nobu 2015-01-24 10:56:28 +00:00
Родитель 26d0a2a3d6
Коммит ad3b5d6376
2 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Sat Jan 24 19:56:25 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dln_find.c (dln_find_1): search regular files only. based on
the patch by Alex Coomans in [ruby-core:67766]. [Bug #10776]
Fri Jan 23 23:57:05 2015 Misumi Rize <r@ayase-e.li>
* vm_insnhelper.c (vm_throw_start): search the target to break

Просмотреть файл

@ -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 */