ruby-changes:50140
From: k0kubun <ko1@a...>
Date: Wed, 7 Feb 2018 00:19:14 +0900 (JST)
Subject: [ruby-changes:50140] k0kubun:r62258 (trunk): mjit.c: handle fopen error
k0kubun 2018-02-07 00:19:10 +0900 (Wed, 07 Feb 2018) New Revision: 62258 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62258 Log: mjit.c: handle fopen error [Bug #14441] Modified files: trunk/mjit.c Index: mjit.c =================================================================== --- mjit.c (revision 62257) +++ mjit.c (revision 62258) @@ -91,6 +91,7 @@ https://github.com/ruby/ruby/blob/trunk/mjit.c#L91 #include <sys/time.h> #include <dlfcn.h> #endif +#include <errno.h> extern void rb_native_mutex_lock(rb_nativethread_lock_t *lock); extern void rb_native_mutex_unlock(rb_nativethread_lock_t *lock); @@ -698,6 +699,11 @@ convert_unit_to_func(struct rb_mjit_unit https://github.com/ruby/ruby/blob/trunk/mjit.c#L699 sprintf(funcname, "_mjit%d", unit->id); f = fopen(c_file, "w"); + if (f == NULL) { + verbose(1, "Failed to fopen '%s', giving up JIT for it (%s)", c_file, strerror(errno)); + return (mjit_func_t)NOT_COMPILABLE_JIT_ISEQ_FUNC; + } + /* -include-pch is used for Clang */ if (mjit_opts.cc == MJIT_CC_GCC) { const char *s = pch_file; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/