Skip to content
Snippets Groups Projects
Commit 9d01baf2 authored by Olav Morken's avatar Olav Morken
Browse files

SimpleSAML_Utilities: Better error handling when opening /dev/urandom.

This code would create a loop in the error handler under windows.
Instead of trying to open the file, and handle the error, instead
check whether the file exists first.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1715 44740490-163a-0410-bde0-09ae8108e29a
parent e42591a3
No related branches found
No related tags found
No related merge requests found
...@@ -1122,7 +1122,11 @@ class SimpleSAML_Utilities { ...@@ -1122,7 +1122,11 @@ class SimpleSAML_Utilities {
assert('is_int($length)'); assert('is_int($length)');
if($fp === NULL) { if($fp === NULL) {
$fp = @fopen('/dev/urandom', 'rb'); if (file_exists('/dev/urandom')) {
$fp = fopen('/dev/urandom', 'rb');
} else {
$fp = FALSE;
}
} }
if($fp !== FALSE) { if($fp !== FALSE) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment