about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-09-15 12:01:26 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-09-15 12:01:26 +0000
commit9a0980fadf9b7a2a4a9c239f3ae667483ea175da (patch)
tree0f23b165933b292712eec4f35459fd1d6d96d9f4 /src
parent6f3e9754ef9446cb8a9f98e593aed23a730c4c10 (diff)
downloads6-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.c7
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)