From 7c2c80af1b9e2fd84f71a0e65623d3fd09fe15f1 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Thu, 11 Sep 2008 15:21:19 +0100 Subject: [PATCH] Check the return value of read(); Fixes #336. --- src/core/random-variable.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/random-variable.cc b/src/core/random-variable.cc index 6a08378b2..6992e0052 100644 --- a/src/core/random-variable.cc +++ b/src/core/random-variable.cc @@ -196,7 +196,9 @@ void RandomVariableBase::GetRandomSeeds(uint32_t seeds[6]) { 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 }