summaryrefslogtreecommitdiff
blob: da814f11b8c593465f6cf746ca2d27c36e29d860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 2b72637f06ad35bd5458372a964bf30a0b4f7cf9 Mon Sep 17 00:00:00 2001
From: Alon Bar-Lev <alon.barlev@gmail.com>
Date: Thu, 1 Dec 2016 21:55:17 +0200
Subject: [PATCH] system_rng: workaround read only urandom

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
---
 src/lib/rng/system_rng/system_rng.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lib/rng/system_rng/system_rng.cpp b/src/lib/rng/system_rng/system_rng.cpp
index eaba382..12b0876 100644
--- a/src/lib/rng/system_rng/system_rng.cpp
+++ b/src/lib/rng/system_rng/system_rng.cpp
@@ -135,8 +135,11 @@ void System_RNG_Impl::add_entropy(const uint8_t input[], size_t len)
          * by the OS or sysadmin that additional entropy is not wanted
          * in the system pool, so we accept that and return here,
          * since there is no corrective action possible.
+	 *
+	 * In Linux EBADF or EPERM is returned if m_fd is not opened for
+	 * writing.
          */
-         if(errno == EPERM)
+         if(errno == EPERM || errno == EBADF)
             return;
 
          // maybe just ignore any failure here and return?
-- 
2.7.3