Commit 8cfe199f authored by Francis Ma's avatar Francis Ma Committed by Andrii Grynenko

Move static global variable randomDevice inside the scope of the function

Test Plan: Tests under folly passed

Reviewed By: seanc@fb.com

Subscribers: trunkagent, seanc, njormrod

FB internal diff: D1600266

Tasks: 5317470
parent 8961aec7
...@@ -30,10 +30,9 @@ namespace folly { ...@@ -30,10 +30,9 @@ namespace folly {
namespace { namespace {
// Keep it open for the duration of the program
File randomDevice("/dev/urandom");
void readRandomDevice(void* data, size_t size) { void readRandomDevice(void* data, size_t size) {
// Keep it open for the duration of the program
static File randomDevice("/dev/urandom");
PCHECK(readFull(randomDevice.fd(), data, size) == size); PCHECK(readFull(randomDevice.fd(), data, size) == size);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment