From fb57ad9b9d107856e5f1c8135da04ffa2f7a11ac Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Mon, 14 Feb 2022 21:17:39 +0100 Subject: build: Fix errors with glibc < 2.25 getrandom and sys/random.h are only available since glibc 2.25: https://www.gnu.org/software/gnulib/manual/html_node/sys_002frandom_002eh.html resulting in the following build failures since version 5.63 and https://git.kernel.org/pub/scm/bluetooth/bluez.git/log/?qt=grep&q=getrandom: plugins/autopair.c:20:24: fatal error: sys/random.h: No such file or directory #include ^ To fix this build failure, add util_getrandom and a fallback (borrowed from pipewire and licensed under MIT): https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/pipewire/utils.c Fixes: - http://autobuild.buildroot.org/results/6b8870d12e0804d6154230a7322c49416c1dc0e2 --- peripheral/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'peripheral') diff --git a/peripheral/main.c b/peripheral/main.c index 91adb45fc..b82d7caf6 100644 --- a/peripheral/main.c +++ b/peripheral/main.c @@ -25,13 +25,13 @@ #include #include #include -#include #ifndef WAIT_ANY #define WAIT_ANY (-1) #endif #include "src/shared/mainloop.h" +#include "src/shared/util.h" #include "peripheral/efivars.h" #include "peripheral/attach.h" #include "peripheral/gap.h" @@ -192,7 +192,7 @@ int main(int argc, char *argv[]) addr, 6) < 0) { printf("Generating new persistent static address\n"); - if (getrandom(addr, sizeof(addr), 0) < 0) { + if (util_getrandom(addr, sizeof(addr), 0) < 0) { perror("Failed to get random static address"); return EXIT_FAILURE; } -- cgit v1.2.1