diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-08-22 16:32:34 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-08-23 09:46:40 +0200 |
commit | f26c3979ab0325edb2e410d287bc501cf00e0ac0 (patch) | |
tree | 4181e92f2d78e4be9a4612f7da6ce934534d7d4d | |
parent | c212d619cd8356ddd61df90b31974f60b1a3d4d5 (diff) | |
download | gnutls-f26c3979ab0325edb2e410d287bc501cf00e0ac0.tar.gz |
rnd-linux: added check for SYS_getrandom being defined
This allows to compile the getrandom() code in old Linux systems
which do not have the system call defined.
-rw-r--r-- | lib/nettle/rnd-linux.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/nettle/rnd-linux.c b/lib/nettle/rnd-linux.c index d7f07a6eba..7a24d05f6f 100644 --- a/lib/nettle/rnd-linux.c +++ b/lib/nettle/rnd-linux.c @@ -56,7 +56,11 @@ static dev_t _gnutls_urandom_fd_rdev = 0; # else # include <sys/syscall.h> # undef getrandom -# define getrandom(dst,s,flags) syscall(SYS_getrandom, (void*)dst, (size_t)s, (unsigned int)flags) +# if defined(SYS_getrandom) +# define getrandom(dst,s,flags) syscall(SYS_getrandom, (void*)dst, (size_t)s, (unsigned int)flags) +# else +# define getrandom(dst,s,flags) -1 +# endif # endif static unsigned have_getrandom(void) |