From: Francis Ma Date: Thu, 9 Oct 2014 15:35:06 +0000 (-0700) Subject: Move static global variable randomDevice inside the scope of the function X-Git-Tag: v0.22.0~288 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8cfe199f9c5a5676e3ff71e020efbb008f02a9ef;p=folly.git 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 --- diff --git a/folly/Random.cpp b/folly/Random.cpp index a189c3fc..99a74f55 100644 --- a/folly/Random.cpp +++ b/folly/Random.cpp @@ -30,10 +30,9 @@ namespace folly { namespace { -// Keep it open for the duration of the program -File randomDevice("/dev/urandom"); - 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); }