Project

General

Profile

Bug #4579 ยป securerandom-openssl-pid-recycle.patch

akr (Akira Tanaka), 06/13/2011 01:11 AM

View differences:

lib/securerandom.rb (working copy)
57 57
    n ||= 16
58 58

  
59 59
    if defined? OpenSSL::Random
60
      @pid = $$ if !defined?(@pid)
61
      pid = $$
62
      if @pid != pid
63
        now = Time.now
64
        OpenSSL::Random.seed(now.to_i.to_s + now.nsec.to_s)
65
        @pid = pid
66
      end
60 67
      return OpenSSL::Random.random_bytes(n)
61 68
    end
62 69