diff --git a/ChangeLog b/ChangeLog index bd80d818be..e831ade0c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Mon May 7 20:23:29 2012 Tanaka Akira + + * lib/securerandom.rb (random_bytes): call to_int method for the + argument at first. + +Mon May 7 20:23:29 2012 Tanaka Akira + + * lib/securerandom.rb: show actual read length in an error message. + Mon May 7 11:09:20 2012 NARUSE, Yui * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): define IDs before diff --git a/lib/securerandom.rb b/lib/securerandom.rb index 04e8bc205e..d4ab947f54 100644 --- a/lib/securerandom.rb +++ b/lib/securerandom.rb @@ -54,7 +54,7 @@ module SecureRandom # If secure random number generator is not available, # NotImplementedError is raised. def self.random_bytes(n=nil) - n ||= 16 + n = n ? n.to_int : 16 if defined? OpenSSL::Random @pid = 0 if !defined?(@pid) @@ -80,7 +80,7 @@ module SecureRandom @has_urandom = true ret = f.readpartial(n) if ret.length != n - raise NotImplementedError, "Unexpected partial read from random device" + raise NotImplementedError, "Unexpected partial read from random device: only #{ret.length} for #{n} bytes" end return ret } diff --git a/version.h b/version.h index b34fca3c97..dcefb796cf 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 205 +#define RUBY_PATCHLEVEL 206 #define RUBY_RELEASE_DATE "2012-05-07" #define RUBY_RELEASE_YEAR 2012