From df61f19daf08de1e7baa88cfb01ec215bc18da10 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Mon, 28 Nov 2016 12:37:36 -0500 Subject: [PATCH] [core] compile fix for Mac OS X 10.6 (old) (fixes #2773) Mac OS X 10.7 Lion introduces arc4random_buf() (thx ryandesign) x-ref: "Mac OS X build issue Undefined symbols" https://redmine.lighttpd.net/issues/2773 --- SConstruct | 2 +- configure.ac | 2 +- src/CMakeLists.txt | 2 +- src/rand.c | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SConstruct b/SConstruct index 83ebe43a..a0a4558d 100644 --- a/SConstruct +++ b/SConstruct @@ -221,7 +221,7 @@ if 1: getuid select signal pathconf madvise prctl\ writev sigaction sendfile64 send_file kqueue port_create localtime_r posix_fadvise issetugid inet_pton \ memset_s explicit_bzero clock_gettime \ - getentropy arc4random jrand48 srandom getloadavg')) + getentropy arc4random_buf jrand48 srandom getloadavg')) checkFunc(autoconf, 'getrandom', 'linux/random.h') checkTypes(autoconf, Split('pid_t size_t off_t')) diff --git a/configure.ac b/configure.ac index 21ff518f..421702da 100644 --- a/configure.ac +++ b/configure.ac @@ -773,7 +773,7 @@ AC_CHECK_FUNCS([dup2 getcwd inet_ntoa inet_ntop inet_pton issetugid memset mmap getuid select signal pathconf madvise posix_fadvise posix_madvise \ writev sigaction sendfile64 send_file kqueue port_create localtime_r gmtime_r \ memset_s explicit_bzero clock_gettime \ - getentropy arc4random jrand48 srandom getloadavg]) + getentropy arc4random_buf jrand48 srandom getloadavg]) AC_CHECK_HEADERS([linux/random.h],[ AC_CHECK_FUNC([getrandom], AC_DEFINE([HAVE_GETRANDOM], [1], [getrandom])) ]) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f7e4de6a..2c11c477 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -129,7 +129,7 @@ set(CMAKE_EXTRA_INCLUDE_FILES) check_type_size(long SIZEOF_LONG) check_type_size(off_t SIZEOF_OFF_T) -check_function_exists(arc4random HAVE_ARC4RANDOM) +check_function_exists(arc4random_buf HAVE_ARC4RANDOM_BUF) check_function_exists(chroot HAVE_CHROOT) check_function_exists(epoll_ctl HAVE_EPOLL_CTL) check_function_exists(fork HAVE_FORK) diff --git a/src/rand.c b/src/rand.c index a6a492c1..46ee1cac 100644 --- a/src/rand.c +++ b/src/rand.c @@ -125,7 +125,7 @@ void li_rand_reseed (void) u = ((unsigned int)xsubi[0] << 16) | xsubi[1]; } else { - #ifdef HAVE_ARC4RANDOM + #ifdef HAVE_ARC4RANDOM_BUF u = arc4random(); arc4random_buf(xsubi, sizeof(xsubi)); #else @@ -155,7 +155,7 @@ int li_rand (void) int i; if (-1 != RAND_pseudo_bytes((unsigned char *)&i, sizeof(i))) return i; #endif - #ifdef HAVE_ARC4RANDOM + #ifdef HAVE_ARC4RANDOM_BUF return (int)arc4random(); #elif defined(HAVE_SRANDOM) /* coverity[dont_call : FALSE] */ -- 2.11.4.GIT