aboutsummaryrefslogtreecommitdiffstats
path: root/mjit.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-07 08:14:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-07 08:14:15 +0000
commit2cb31e532706effce5a04877035fdb9dfd4febec (patch)
tree3906532653e2c1e426ce10eb955a2113992e9467 /mjit.c
parent039db0d2faa067a46b0b10dc0f04dc144879ecc7 (diff)
downloadruby-2cb31e532706effce5a04877035fdb9dfd4febec.tar.gz
mjit.c: FD instead of FILE
* mjit.c (init_header_filename): just FD instead of FILE to check file is accessible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mjit.c b/mjit.c
index 24aae5432b..10056ec169 100644
--- a/mjit.c
+++ b/mjit.c
@@ -1107,7 +1107,7 @@ mjit_get_iseq_func(const struct rb_iseq_constant_body *body)
static void
init_header_filename(void)
{
- FILE *f;
+ int fd;
/* Root path of the running ruby process. Equal to RbConfig::TOPDIR. */
VALUE basedir_val;
char *basedir;
@@ -1134,12 +1134,12 @@ init_header_filename(void)
return;
p = append_str2(header_file, basedir, baselen);
p = append_str2(p, header_name, sizeof(header_name));
- if ((f = fopen(header_file, "r")) == NULL) {
+ if ((fd = rb_cloexec_open(header_file, O_RDONLY, 0)) < 0) {
xfree(header_file);
header_file = NULL;
return;
}
- fclose(f);
+ (void)close(fd);
#ifdef _WIN32
p = libruby_build = xmalloc(sizeof(libpathflag)-1 + baselen + 1);