summaryrefslogtreecommitdiff
path: root/random.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-19 03:16:58 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-19 03:16:58 (GMT)
commita14cb8ad5b432bcda7b6a4a0ee41a1a292d0b568 (patch)
tree40e7cc264d6dc9425ebf9585c75346002c5b3ea6 /random.c
parent77f1277e1d154aa7858e9584559d648b1df2865d (diff)
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/trunk@59368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'random.c')
-rw-r--r--random.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/random.c b/random.c
index 6555cc5..8ea28a5 100644
--- a/random.c
+++ b/random.c
@@ -338,7 +338,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 *
@@ -348,7 +348,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: */