Skip to content

Commit

Permalink
[BUG FIX] $URANDOM_FH is closed FH if there is no /dev/urandom.
Browse files Browse the repository at this point in the history
We should undef() if it can't open /dev/urandom.
  • Loading branch information
tokuhirom committed Aug 1, 2014
1 parent 89a8909 commit d018c36
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/HTTP/Session2/Random.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ our $URANDOM_FH;

# $URANDOM_FH is undef if there is no /dev/urandom
open $URANDOM_FH, '<:raw', '/dev/urandom'
or warn "Cannot open /dev/urandom: $!.";
or do {
undef $URANDOM_FH;
warn "Cannot open /dev/urandom: $!.";
};

sub generate_session_id {
if ($URANDOM_FH) {
Expand Down

0 comments on commit d018c36

Please sign in to comment.