Check the return value of read(); Fixes #336.
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Thu, 11 Sep 2008 15:21:19 +0100
changeset 3678 3a4021da265d
parent 3677 33334b53632f
child 3679 07fdb67e52bb
Check the return value of read(); Fixes #336.
src/core/random-variable.cc
--- a/src/core/random-variable.cc	Thu Sep 11 11:44:39 2008 +0100
+++ b/src/core/random-variable.cc	Thu Sep 11 15:21:19 2008 +0100
@@ -196,7 +196,9 @@
         {
           for (int i = 0; i < 6; ++i)
             {
-              read(RandomVariableBase::devRandom, &seeds[i], sizeof(seeds[i]));
+              ssize_t bytes_read = read (RandomVariableBase::devRandom,
+                                         &seeds[i], sizeof (seeds[i]));
+              NS_ASSERT (bytes_read == sizeof (seeds[i]));
             }
           if (RngStream::CheckSeed(seeds)) break; // Got a valid one
         }