From 3e4ae45a6930bce59fb77790aa29a82eecf6ec23 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Thu, 23 Jun 2016 14:32:23 -0400 Subject: [PATCH] Fix: check for rand_r() in compat-rand.h The rand_r() function exists in newer Android versions, detect it instead of relying on the __ANDROID__ define. Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- configure.ac | 1 + src/compat-rand.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6a481e3..cd5a05a 100644 --- a/configure.ac +++ b/configure.ac @@ -94,6 +94,7 @@ AC_CHECK_FUNCS([ \ memeset \ memset \ munmap \ + rand_r \ sched_getcpu \ strerror \ strtoul \ diff --git a/src/compat-rand.h b/src/compat-rand.h index 7c6acde..835d99b 100644 --- a/src/compat-rand.h +++ b/src/compat-rand.h @@ -28,7 +28,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifdef __ANDROID__ +#ifndef HAVE_RAND_R /* * Reentrant random function from POSIX.1c. * Copyright (C) 1996, 1999 Free Software Foundation, Inc. @@ -58,6 +58,6 @@ static inline int rand_r(unsigned int *seed) return result; } -#endif /* __ANDROID__ */ +#endif /* HAVE_RAND_R */ #endif /* _COMPAT_RAND_H */ -- 2.34.1