[前][次][番号順一覧][スレッド一覧]

ruby-changes:50161

From: nobu <ko1@a...>
Date: Wed, 7 Feb 2018 17:14:18 +0900 (JST)
Subject: [ruby-changes:50161] nobu:r62279 (trunk): mjit.c: FD instead of FILE

nobu	2018-02-07 17:14:15 +0900 (Wed, 07 Feb 2018)

  New Revision: 62279

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62279

  Log:
    mjit.c: FD instead of FILE
    
    * mjit.c (init_header_filename): just FD instead of FILE to check
      file is accessible.

  Modified files:
    trunk/mjit.c
Index: mjit.c
===================================================================
--- mjit.c	(revision 62278)
+++ mjit.c	(revision 62279)
@@ -1107,7 +1107,7 @@ mjit_get_iseq_func(const struct rb_iseq_ https://github.com/ruby/ruby/blob/trunk/mjit.c#L1107
 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) https://github.com/ruby/ruby/blob/trunk/mjit.c#L1134
         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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]