diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-09-20 18:22:27 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-09-20 18:22:27 +0000 |
commit | 6011d413604df8224b91ca9f9b3d50663b60e117 (patch) | |
tree | ca36404ebcc87922d26664dd93e2c0ebd23bef67 /src/librandom | |
parent | 98d3a523be4fff36f65e71c37df8b9e127b12b83 (diff) | |
download | skalibs-6011d413604df8224b91ca9f9b3d50663b60e117.tar.xz |
sysdeps redesign: first part: minimize clr tests
Remaining clr:
emptyregex: can be safely guessed to no
nullispointer: can't be safely guessed, but do we need the test?
devurandom: can't be safely guessed
malloc0: can more or less be safely guessed to no
Diffstat (limited to 'src/librandom')
-rw-r--r-- | src/librandom/random_string.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/librandom/random_string.c b/src/librandom/random_string.c index f8cabc3..acdec69 100644 --- a/src/librandom/random_string.c +++ b/src/librandom/random_string.c @@ -16,21 +16,14 @@ void random_string (char *s, size_t n) #else #ifdef SKALIBS_HASGETRANDOM -#include <skalibs/nonposix.h> -#include <unistd.h> -#include <sys/syscall.h> +#include <sys/random.h> #include <skalibs/random.h> -static int getrandom (void *buf, size_t buflen, unsigned int flags) -{ - return syscall(SYS_getrandom, buf, buflen, flags) ; -} - void random_string (char *s, size_t n) { while (n) { - int r = getrandom(s, n, 0) ; + ssize_t r = getrandom(s, n, 0) ; if (r >= 0) { s += r ; |