From 422d91b2b0a2b8b3a8af510cc55b1400c60be303 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 24 Oct 2016 02:07:21 +0000 Subject: This one escaped the previous commit: random_init changes --- src/librandom/random_init.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/librandom/random_init.c b/src/librandom/random_init.c index 6a30db1..4c9fce7 100644 --- a/src/librandom/random_init.c +++ b/src/librandom/random_init.c @@ -34,16 +34,20 @@ int random_init () } #else -#ifdef SKALIBS_HASDEVURANDOM -#include #include #include #include "random-internal.h" -int random_fd = -1 ; SURFSchedule surf_here = SURFSCHEDULE_ZERO ; +#ifdef SKALIBS_HASDEVURANDOM + +#include +#include + +int random_fd = -1 ; + int random_init () { int fd ; @@ -55,7 +59,13 @@ int random_init () { fd = open_readb("/dev/urandom") ; if (fd < 0) return 0 ; - if (coe(fd) < 0) { fd_close(fd) ; return 0 ; } + if (coe(fd) < 0) + { + int e = errno ; + fd_close(fd) ; + errno = e ; + return 0 ; + } random_fd = fd ; } return 1 ; @@ -63,12 +73,6 @@ int random_init () #else /* default */ -#include -#include -#include "random-internal.h" - -SURFSchedule surf_here = SURFSCHEDULE_ZERO ; - int random_init () { char seed[160] ; -- cgit v1.2.3