diff options
author | Patrick Oppenlander <patrick.oppenlander@gmail.com> | 2018-07-18 15:09:13 +1000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2018-08-03 16:13:47 -0500 |
commit | db017ea49b316d7d95a2641650648cbd6bbde03e (patch) | |
tree | 6dfbd7309c857798b57e265c57729f3b54fae819 | |
parent | b51fcf8e7946aa3a059634804bd426f1b6fab571 (diff) | |
download | toybox-db017ea49b316d7d95a2641650648cbd6bbde03e.tar.gz |
xgetrandom: use getrandom result if it succeeds
-rw-r--r-- | lib/portability.c | 4 |
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); |