aboutsummaryrefslogtreecommitdiffstats
path: root/mjit.c
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-06 15:19:10 +0000
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-06 15:19:10 +0000
commit1a64f842ef69e359c529d08ad553a3d411e22f59 (patch)
tree42e390c41754fd1c871c26cf2886044b5923849c /mjit.c
parent7536797f815ab1d30175516f0709cc6fdd46a95b (diff)
downloadruby-1a64f842ef69e359c529d08ad553a3d411e22f59.tar.gz
mjit.c: handle fopen error
[Bug #14441] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit.c')
-rw-r--r--mjit.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mjit.c b/mjit.c
index 0bb50aecd9..3bf82f7529 100644
--- a/mjit.c
+++ b/mjit.c
@@ -91,6 +91,7 @@
#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 *unit)
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;