From 86024f70cff6c8029633467fd919f1b8cd9cd36c Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 9 Aug 2017 10:32:37 +0000 Subject: merge revision(s) 59368: [Backport #13753] random.c: ensure initialized * random.c (get_rnd, try_get_rnd): ensure initialized to get rid of crash in forked processes. [ruby-core:82100] [Bug #13753] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- random.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'random.c') diff --git a/random.c b/random.c index 936121f49e..8e5d1659a8 100644 --- a/random.c +++ b/random.c @@ -361,7 +361,7 @@ get_rnd(VALUE obj) { rb_random_t *ptr; TypedData_Get_Struct(obj, rb_random_t, &random_data_type, ptr); - return ptr; + return rand_start(ptr); } static rb_random_t * @@ -371,7 +371,7 @@ try_get_rnd(VALUE obj) return rand_start(&default_rand); } if (!rb_typeddata_is_kind_of(obj, &random_data_type)) return NULL; - return DATA_PTR(obj); + return rand_start(DATA_PTR(obj)); } /* :nodoc: */ -- cgit v1.2.3