Skip to content

Commit

Permalink
merge revision(s) 22654:22661:
Browse files Browse the repository at this point in the history
	* 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]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@23040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
shyouhei committed Mar 23, 2009
1 parent 46496ac commit e6f839c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 25 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
Mon Mar 23 17:41:49 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>

* 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]

Mon Mar 9 20:59:24 2009 Shugo Maeda <shugo@ruby-lang.org>

* ext/openssl/ossl_ocsp.c (ossl_ocspbres_verify): OCSP_basic_verify
Expand Down
34 changes: 13 additions & 21 deletions file.c
Expand Up @@ -288,7 +288,6 @@ rb_stat_dev_minor(self)
#endif
}


/*
* call-seq:
* stat.ino => fixnum
Expand Down Expand Up @@ -353,7 +352,6 @@ rb_stat_nlink(self)
return UINT2NUM(get_stat(self)->st_nlink);
}


/*
* call-seq:
* stat.uid => fixnum
Expand Down Expand Up @@ -388,7 +386,6 @@ rb_stat_gid(self)
return UINT2NUM(get_stat(self)->st_gid);
}


/*
* call-seq:
* stat.rdev => fixnum or nil
Expand Down Expand Up @@ -518,7 +515,6 @@ rb_stat_blocks(self)
#endif
}


/*
* call-seq:
* stat.atime => time
Expand Down Expand Up @@ -784,7 +780,6 @@ rb_file_s_lstat(klass, fname)
#endif
}


/*
* call-seq:
* file.lstat => stat
Expand Down Expand Up @@ -914,7 +909,6 @@ eaccess(path, mode)
*
*/


/*
* call-seq:
* File.directory?(file_name) => true or false
Expand Down Expand Up @@ -1103,7 +1097,6 @@ test_c(obj, fname)
return Qfalse;
}


/*
* call-seq:
* File.exist?(file_name) => true or false
Expand Down Expand Up @@ -1156,7 +1149,6 @@ test_R(obj, fname)
return Qtrue;
}


/*
* call-seq:
* File.writable?(file_name) => true or false
Expand Down Expand Up @@ -1934,7 +1926,6 @@ lchown_internal(path, argp)
rb_sys_fail(path);
}


/*
* call-seq:
* file.lchown(owner_int, group_int, file_name,..) => integer
Expand Down Expand Up @@ -3630,7 +3621,6 @@ rb_f_test(argc, argv)
}



/*
* Document-class: File::Stat
*
Expand Down Expand Up @@ -3948,8 +3938,6 @@ rb_stat_r(obj)
return Qtrue;
}



/*
* call-seq:
* stat.readable_real? -> true or false
Expand Down Expand Up @@ -4098,7 +4086,6 @@ rb_stat_x(obj)
* the process.
*/


static VALUE
rb_stat_X(obj)
VALUE obj;
Expand Down Expand Up @@ -4162,7 +4149,6 @@ rb_stat_z(obj)
return Qfalse;
}


/*
* call-seq:
* state.size => integer
Expand Down Expand Up @@ -4379,13 +4365,19 @@ static int
file_load_ok(file)
const 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;
Expand Down
8 changes: 4 additions & 4 deletions version.h
@@ -1,15 +1,15 @@
#define RUBY_VERSION "1.8.7"
#define RUBY_RELEASE_DATE "2009-03-09"
#define RUBY_RELEASE_DATE "2009-03-23"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20090309
#define RUBY_PATCHLEVEL 150
#define RUBY_RELEASE_CODE 20090323
#define RUBY_PATCHLEVEL 151

#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_YEAR 2009
#define RUBY_RELEASE_MONTH 3
#define RUBY_RELEASE_DAY 9
#define RUBY_RELEASE_DAY 23

#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];
Expand Down

0 comments on commit e6f839c

Please sign in to comment.