This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  02e0f707a9b63eba1219563afb253e0bd91353bb (commit)
       via  8f153e9b9157236a14bc6a289453d6d4934ea048 (commit)
      from  fd8d38038c72efac13f7fbf040669697890c3a94 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=02e0f707a9b63eba1219563afb253e0bd91353bb
commit 02e0f707a9b63eba1219563afb253e0bd91353bb
Merge: fd8d380 8f153e9
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Wed Feb 17 09:05:01 2016 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Wed Feb 17 09:05:01 2016 -0500

    Merge topic 'reduce-entropy-consumption' into next
    
    8f153e9b cmSystemTools: Avoid excess entropy consumption by RandomSeed 
(#15976)


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8f153e9b9157236a14bc6a289453d6d4934ea048
commit 8f153e9b9157236a14bc6a289453d6d4934ea048
Author:     Cristian Rodríguez <crrodrig...@opensuse.org>
AuthorDate: Wed Feb 17 09:02:04 2016 -0500
Commit:     Brad King <brad.k...@kitware.com>
CommitDate: Wed Feb 17 09:04:44 2016 -0500

    cmSystemTools: Avoid excess entropy consumption by RandomSeed (#15976)
    
    Read `/dev/urandom` without buffering to avoid taking more than we need.

diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 3ba7287..5ad2475 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2184,8 +2184,10 @@ unsigned int cmSystemTools::RandomSeed()
   } seed;
 
   // Try using a real random source.
-  cmsys::ifstream fin("/dev/urandom");
-  if(fin && fin.read(seed.bytes, sizeof(seed)) &&
+  cmsys::ifstream fin;
+  fin.rdbuf()->pubsetbuf(0, 0); // Unbuffered read.
+  fin.open("/dev/urandom");
+  if(fin.good() && fin.read(seed.bytes, sizeof(seed)) &&
      fin.gcount() == sizeof(seed))
     {
     return seed.integer;

-----------------------------------------------------------------------

Summary of changes:
 Source/cmSystemTools.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to