From: Michael Jeanson Date: Thu, 23 Jun 2016 18:32:23 +0000 (-0400) Subject: Fix: check for rand_r() in compat-rand.h X-Git-Tag: v0.10.0~24 X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=commitdiff_plain;h=3e4ae45a6930bce59fb77790aa29a82eecf6ec23;ds=sidebyside 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 --- 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 */