ruby-changes:11414
From: shyouhei <ko1@a...>
Date: Mon, 23 Mar 2009 17:41:20 +0900 (JST)
Subject: [ruby-changes:11414] Ruby:r23038 (ruby_1_8_6): merge revision(s) 22654:22661:
shyouhei 2009-03-23 17:41:12 +0900 (Mon, 23 Mar 2009) New Revision: 23038 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23038 Log: merge revision(s) 22654:22661: * file.c (file_load_ok): checks if regular file, except for the platform disallows to open directories, e.g. dosish. [ruby-dev:38097], [Bug #1221] Modified files: branches/ruby_1_8_6/ChangeLog branches/ruby_1_8_6/file.c branches/ruby_1_8_6/version.h Index: ruby_1_8_6/ChangeLog =================================================================== --- ruby_1_8_6/ChangeLog (revision 23037) +++ ruby_1_8_6/ChangeLog (revision 23038) @@ -1,3 +1,9 @@ +Mon Mar 23 17:39:29 2009 Nobuyoshi Nakada <nobu@r...> + + * file.c (file_load_ok): checks if regular file, except for the + platform disallows to open directories, e.g. dosish. + [ruby-dev:38097], [Bug #1221] + Tue Mar 10 16:05:36 2009 Akinori MUSHA <knu@i...> * ext/openssl/openssl_missing.c (HMAC_CTX_copy): adopted Index: ruby_1_8_6/version.h =================================================================== --- ruby_1_8_6/version.h (revision 23037) +++ ruby_1_8_6/version.h (revision 23038) @@ -1,15 +1,15 @@ #define RUBY_VERSION "1.8.6" -#define RUBY_RELEASE_DATE "2009-03-10" +#define RUBY_RELEASE_DATE "2009-03-23" #define RUBY_VERSION_CODE 186 -#define RUBY_RELEASE_CODE 20090310 -#define RUBY_PATCHLEVEL 362 +#define RUBY_RELEASE_CODE 20090323 +#define RUBY_PATCHLEVEL 363 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 #define RUBY_VERSION_TEENY 6 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 3 -#define RUBY_RELEASE_DAY 10 +#define RUBY_RELEASE_DAY 23 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; Index: ruby_1_8_6/file.c =================================================================== --- ruby_1_8_6/file.c (revision 23037) +++ ruby_1_8_6/file.c (revision 23038) @@ -291,7 +291,6 @@ #endif } - /* * call-seq: * stat.ino => fixnum @@ -356,7 +355,6 @@ return UINT2NUM(get_stat(self)->st_nlink); } - /* * call-seq: * stat.uid => fixnum @@ -391,7 +389,6 @@ return UINT2NUM(get_stat(self)->st_gid); } - /* * call-seq: * stat.rdev => fixnum or nil @@ -521,7 +518,6 @@ #endif } - /* * call-seq: * stat.atime => time @@ -787,7 +783,6 @@ #endif } - /* * call-seq: * file.lstat => stat @@ -917,7 +912,6 @@ * */ - /* * call-seq: * File.directory?(file_name) => true or false @@ -1106,7 +1100,6 @@ return Qfalse; } - /* * call-seq: * File.exist?(file_name) => true or false @@ -1159,7 +1152,6 @@ return Qtrue; } - /* * call-seq: * File.writable?(file_name) => true or false @@ -1937,7 +1929,6 @@ rb_sys_fail(path); } - /* * call-seq: * file.lchown(owner_int, group_int, file_name,..) => integer @@ -3629,7 +3620,6 @@ } - /* * Document-class: File::Stat * @@ -3947,8 +3937,6 @@ return Qtrue; } - - /* * call-seq: * stat.readable_real? -> true or false @@ -4097,7 +4085,6 @@ * the process. */ - static VALUE rb_stat_X(obj) VALUE obj; @@ -4161,7 +4148,6 @@ return Qfalse; } - /* * call-seq: * state.size => integer @@ -4378,13 +4364,19 @@ file_load_ok(file) char *file; { - FILE *f; - - if (!file) return 0; - f = fopen(file, "r"); - if (f == NULL) return 0; - fclose(f); - return 1; + int ret = 1; + int fd = open(file, O_RDONLY); + if (fd == -1) return 0; +#if !defined DOSISH + { + struct stat st; + if (fstat(fd, &st) || !S_ISREG(st.st_mode)) { + ret = 0; + } + } +#endif + (void)close(fd); + return ret; } extern VALUE rb_load_path; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/