From 8cfe199f9c5a5676e3ff71e020efbb008f02a9ef Mon Sep 17 00:00:00 2001 From: Francis Ma Date: Thu, 9 Oct 2014 08:35:06 -0700 Subject: [PATCH] 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 --- folly/Random.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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); } -- 2.34.1