Signed-off-by: Angus Salkeld <[email protected]>
---
 exec/crypto.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/exec/crypto.c b/exec/crypto.c
index 0ae415e..f85f4b9 100644
--- a/exec/crypto.c
+++ b/exec/crypto.c
@@ -1258,9 +1258,10 @@ static unsigned long rng_nix(unsigned char *buf, 
unsigned long len,
 
        fd = open ("/dev/urandom", O_RDONLY);
 
-       rb = (unsigned long)read (fd, buf, len);
-
-       close (fd);
+       if (fd >= 0) {
+               rb = (unsigned long)read (fd, buf, len);
+               close (fd);
+       }
 
        return (rb);
 }
-- 
1.6.6.1

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to