From 9a7e4bf9ea027f6ac5116743a3006c84c7441f50 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 26 Jun 2015 03:48:41 +0000 Subject: transcode.c: fix race condition * transcode.c (load_transcoder_entry): fix transcoder loading race condition, by waiting in require. [ruby-dev:49106] [Bug #11277] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- transcode.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'transcode.c') diff --git a/transcode.c b/transcode.c index 17d406e8be..b9d0adc553 100644 --- a/transcode.c +++ b/transcode.c @@ -370,15 +370,12 @@ load_transcoder_entry(transcoder_entry_t *entry) char *const path = RSTRING_PTR(fn); const int safe = rb_safe_level(); - entry->lib = NULL; - memcpy(path, transcoder_lib_prefix, sizeof(transcoder_lib_prefix) - 1); memcpy(path + sizeof(transcoder_lib_prefix) - 1, lib, len); rb_str_set_len(fn, total_len); FL_UNSET(fn, FL_TAINT); OBJ_FREEZE(fn); - if (!rb_require_safe(fn, safe > 3 ? 3 : safe)) - return NULL; + rb_require_safe(fn, safe > 3 ? 3 : safe); } if (entry->transcoder) -- cgit v1.2.3