Fix getrandom() for glibc <2.25

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König 2023-05-30 22:50:29 +02:00
parent 19c72d354e
commit 40e325de3a
No known key found for this signature in database
1 changed files with 9 additions and 2 deletions

View File

@ -12,8 +12,15 @@
#include "log.h"
#include "config/config.h"
#include "password.h"
// genrandom()
// getrandom() is only available since glibc 2.25
// https://www.gnu.org/software/gnulib/manual/html_node/sys_002frandom_002eh.html
#if !defined(__GLIBC__) || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25)
#include <sys/random.h>
#else
// getrandom_fallback()
#include "daemon.h"
#define getrandom getrandom_fallback
#endif
// Randomness generator
#include "webserver/x509.h"
@ -352,4 +359,4 @@ bool verify_password(const char *password, const char* pwhash)
return result;
}
}
}