diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2016-09-15 12:01:26 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2016-09-15 12:01:26 +0000 |
commit | 9a0980fadf9b7a2a4a9c239f3ae667483ea175da (patch) | |
tree | 0f23b165933b292712eec4f35459fd1d6d96d9f4 /src | |
parent | 6f3e9754ef9446cb8a9f98e593aed23a730c4c10 (diff) | |
download | s6-linux-utils-9a0980fadf9b7a2a4a9c239f3ae667483ea175da.tar.gz s6-linux-utils-9a0980fadf9b7a2a4a9c239f3ae667483ea175da.tar.xz s6-linux-utils-9a0980fadf9b7a2a4a9c239f3ae667483ea175da.zip |
s6-fillurandompool: add workaround for old libcs that don't define SYS_getrandom
Diffstat (limited to 'src')
-rw-r--r-- | src/minutils/s6-fillurandompool.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/minutils/s6-fillurandompool.c b/src/minutils/s6-fillurandompool.c index 775f289..57cd88c 100644 --- a/src/minutils/s6-fillurandompool.c +++ b/src/minutils/s6-fillurandompool.c @@ -5,15 +5,18 @@ #endif #include <unistd.h> +#include <errno.h> #include <sys/syscall.h> #include <skalibs/strerr2.h> #include <skalibs/djbunix.h> -#define USAGE "s6-fillurandompool" - static int getrandom (void *buf, size_t buflen, unsigned int flags) { +#ifdef SYS_getrandom return syscall(SYS_getrandom, buf, buflen, flags) ; +#else + return (errno = ENOSYS, -1) ; +#endif } int main (void) |