aboutsummaryrefslogtreecommitdiff
path: root/lib/portability.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/portability.c')
-rw-r--r--lib/portability.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/portability.c b/lib/portability.c
index 1415141f..2ba3d29f 100644
--- a/lib/portability.c
+++ b/lib/portability.c
@@ -35,8 +35,8 @@ void xgetrandom(void *buf, unsigned buflen, unsigned flags)
int fd;
#if CFG_TOYBOX_GETRANDOM
- if (buflen != getrandom(buf, buflen, flags))
- if (!CFG_TOYBOX_ON_ANDROID || errno!=ENOSYS) perror_exit("getrandom");
+ if (buflen == getrandom(buf, buflen, flags)) return;
+ if (!CFG_TOYBOX_ON_ANDROID || errno!=ENOSYS) perror_exit("getrandom");
#endif
fd = xopen(flags ? "/dev/random" : "/dev/urandom", O_RDONLY);