summaryrefslogtreecommitdiff
path: root/osrng.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'osrng.cpp')
-rw-r--r--osrng.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/osrng.cpp b/osrng.cpp
index c3c4e80..3d307b4 100644
--- a/osrng.cpp
+++ b/osrng.cpp
@@ -126,8 +126,8 @@ void BlockingRng::GenerateBlock(byte *output, size_t size)
{
// on some systems /dev/random will block until all bytes
// are available, on others it will returns immediately
- int len = read(m_fd, output, STDMIN(size, (unsigned int)INT_MAX));
- if (len == -1)
+ ssize_t len = read(m_fd, output, size);
+ if (len < 0)
throw OS_RNG_Err("read /dev/random");
size -= len;
output += len;