diff options
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 34 |
1 files changed, 13 insertions, 21 deletions
@@ -291,7 +291,6 @@ rb_stat_dev_minor(self) #endif } - /* * call-seq: * stat.ino => fixnum @@ -356,7 +355,6 @@ rb_stat_nlink(self) return UINT2NUM(get_stat(self)->st_nlink); } - /* * call-seq: * stat.uid => fixnum @@ -391,7 +389,6 @@ rb_stat_gid(self) return UINT2NUM(get_stat(self)->st_gid); } - /* * call-seq: * stat.rdev => fixnum or nil @@ -521,7 +518,6 @@ rb_stat_blocks(self) #endif } - /* * call-seq: * stat.atime => time @@ -787,7 +783,6 @@ rb_file_s_lstat(klass, fname) #endif } - /* * call-seq: * file.lstat => stat @@ -917,7 +912,6 @@ eaccess(path, mode) * */ - /* * call-seq: * File.directory?(file_name) => true or false @@ -1106,7 +1100,6 @@ test_c(obj, fname) return Qfalse; } - /* * call-seq: * File.exist?(file_name) => true or false @@ -1159,7 +1152,6 @@ test_R(obj, fname) return Qtrue; } - /* * call-seq: * File.writable?(file_name) => true or false @@ -1937,7 +1929,6 @@ lchown_internal(path, argp) rb_sys_fail(path); } - /* * call-seq: * file.lchown(owner_int, group_int, file_name,..) => integer @@ -3629,7 +3620,6 @@ rb_f_test(argc, argv) } - /* * Document-class: File::Stat * @@ -3947,8 +3937,6 @@ rb_stat_r(obj) return Qtrue; } - - /* * call-seq: * stat.readable_real? -> true or false @@ -4097,7 +4085,6 @@ rb_stat_x(obj) * the process. */ - static VALUE rb_stat_X(obj) VALUE obj; @@ -4161,7 +4148,6 @@ rb_stat_z(obj) return Qfalse; } - /* * call-seq: * state.size => integer @@ -4378,13 +4364,19 @@ static int 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; |