summaryrefslogtreecommitdiff
path: root/random
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2019-01-15 15:48:25 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2019-01-15 15:48:25 +0900
commit17f246c7044ab9ed236f6ec73fc126654257f0f9 (patch)
tree27e5c7f81ea80ed09765ba8b2905c23809d57e7e /random
parent2677d7d482bf2d078c1dce64854747c5b148924b (diff)
downloadlibgcrypt-17f246c7044ab9ed236f6ec73fc126654257f0f9.tar.gz
random: Fix previous commit for getentropy function.
* random/rndlinux.c [__NR_getrandom] (_gcry_rndlinux_gather_random): Check return value only for use of syscall. -- The function returns 0 on success. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'random')
-rw-r--r--random/rndlinux.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/random/rndlinux.c b/random/rndlinux.c
index d71261c2..04e2a464 100644
--- a/random/rndlinux.c
+++ b/random/rndlinux.c
@@ -281,9 +281,11 @@ _gcry_rndlinux_gather_random (void (*add)(const void*, size_t,
if (ret == -1)
log_fatal ("unexpected error from getentropy: %s\n",
strerror (errno));
+#ifdef __NR_getrandom
else if (ret != nbytes)
log_fatal ("getentropy returned only"
" %ld of %zu requested bytes\n", ret, nbytes);
+#endif
(*add)(buffer, nbytes, origin);
length -= nbytes;