From 23b65c13f4faae87365837e4b5d301d2ceb5aaeb Mon Sep 17 00:00:00 2001 From: vrana Date: Fri, 6 Apr 2012 09:54:53 -0700 Subject: [PATCH] Use Filesystem::readRandomBytes() in setup Test Plan: Run setup. Reviewers: epriestley Reviewed By: epriestley CC: aran Differential Revision: https://secure.phabricator.com/D2123 --- src/infrastructure/setup/PhabricatorSetup.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/infrastructure/setup/PhabricatorSetup.php b/src/infrastructure/setup/PhabricatorSetup.php index 4eba25c3f6..7a841228e5 100644 --- a/src/infrastructure/setup/PhabricatorSetup.php +++ b/src/infrastructure/setup/PhabricatorSetup.php @@ -75,9 +75,12 @@ final class PhabricatorSetup { $open_arcanist = false; } - $open_urandom = @fopen('/dev/urandom', 'r'); - if (!$open_urandom) { - self::write("Unable to open /dev/urandom!\n"); + $open_urandom = false; + try { + Filesystem::readRandomBytes(1); + $open_urandom = true; + } catch (FilesystemException $ex) { + self::write($ex->getMessage()."\n"); } try {