From abfaac7a6cbdbfad9e7c05bc5ebcb4df57906fcb Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 30 May 2001 09:12:34 +0000 Subject: * ruby.c (proc_options): unexpected SecurityError happens when -T4. * regex.c (re_compile_pattern): * \1 .. \9 should be backreferences always. * regex.c (re_match): backreferences corresponding to unclosed/unmatched parentheses should fail always. * string.c (rb_str_cat): use rb_str_buf_cat() if possible. [new] * string.c (rb_str_append): ditto. * string.c (rb_str_buf_cat): remove unnecessary check (type, taint, modify) to gain performance. * string.c (rb_str_buf_append): ditto. * string.c (rb_str_buf_new): buffering string function. [new] * string.c (rb_str_buf_append): ditto. * string.c (rb_str_buf_cat): ditto. * time.c (make_time_t): local time adjustment revised. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- dln.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'dln.c') diff --git a/dln.c b/dln.c index 36f416a010..6910fa91d3 100644 --- a/dln.c +++ b/dln.c @@ -50,6 +50,10 @@ void *xrealloc(); #include #include +#ifndef S_ISDIR +# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) +#endif + #ifdef HAVE_SYS_PARAM_H # include #else @@ -1582,9 +1586,8 @@ dln_find_1(fname, path, exe_flag) register char *dp; register char *ep; register char *bp; -#ifndef __MACOS__ struct stat st; -#else +#ifdef __MACOS__ const char* mac_fullpath; #endif @@ -1669,13 +1672,17 @@ dln_find_1(fname, path, exe_flag) if (stat(fbuf, &st) == 0) { if (exe_flag == 0) return fbuf; /* looking for executable */ - if (eaccess(fbuf, X_OK) == 0) return fbuf; + if (!S_ISDIR(st.st_mode) && eaccess(fbuf, X_OK) == 0) + return fbuf; } #else if (mac_fullpath = _macruby_exist_file_in_libdir_as_posix_name(fbuf)) { if (exe_flag == 0) return mac_fullpath; /* looking for executable */ - if (eaccess(mac_fullpath, X_OK) == 0) return mac_fullpath; + if (stat(mac_fullpath, &st) == 0) { + if (!S_ISDIR(st.st_mode) && eaccess(mac_fullpath, X_OK) == 0) + return mac_fullpath; + } } #endif #if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__EMX__) -- cgit v1.2.3