Remove compile time check HAVE_DEV_URANDOM.

The code was doing a runtime check, anyway.  The compile time check isn't
always valid (cross-compiling, packages).

Review: https://reviewboard.asterisk.org/r/2245/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377977 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2012-12-13 16:18:52 +00:00
parent 71b1e411b0
commit fad2637297
4 changed files with 251 additions and 316 deletions

544
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -719,11 +719,6 @@ AC_DEFINE([HAVE_SYS_ENDIAN_BSWAP16], 1, [Define to 1 if your sys/endian.h header
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
if test "${cross_compiling}" = "no";
then
AC_CHECK_FILE(/dev/urandom, AC_DEFINE([HAVE_DEV_URANDOM], 1, [Define to 1 if your system has /dev/urandom.]))
fi
AC_MSG_CHECKING(for locale_t in locale.h) AC_MSG_CHECKING(for locale_t in locale.h)
AC_LINK_IFELSE( AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <locale.h>], [locale_t lt = NULL])], [AC_LANG_PROGRAM([#include <locale.h>], [locale_t lt = NULL])],

View File

@@ -173,9 +173,6 @@
/* Define DAHDI headers version */ /* Define DAHDI headers version */
#undef HAVE_DAHDI_VERSION #undef HAVE_DAHDI_VERSION
/* Define to 1 if your system has /dev/urandom. */
#undef HAVE_DEV_URANDOM
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/ */
#undef HAVE_DIRENT_H #undef HAVE_DIRENT_H
@@ -1223,11 +1220,6 @@
/* Define to 1 if running on Darwin. */ /* Define to 1 if running on Darwin. */
#undef _DARWIN_UNLIMITED_SELECT #undef _DARWIN_UNLIMITED_SELECT
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */ /* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS #undef _FILE_OFFSET_BITS

View File

@@ -35,9 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef HAVE_DEV_URANDOM
#include <fcntl.h> #include <fcntl.h>
#endif
#include <sys/syscall.h> #include <sys/syscall.h>
#if defined(__APPLE__) #if defined(__APPLE__)
@@ -496,9 +494,7 @@ const char *ast_inet_ntoa(struct in_addr ia)
return inet_ntop(AF_INET, &ia, buf, INET_ADDRSTRLEN); return inet_ntop(AF_INET, &ia, buf, INET_ADDRSTRLEN);
} }
#ifdef HAVE_DEV_URANDOM
static int dev_urandom_fd; static int dev_urandom_fd;
#endif
#ifndef __linux__ #ifndef __linux__
#undef pthread_create /* For ast_pthread_create function only */ #undef pthread_create /* For ast_pthread_create function only */
@@ -1494,7 +1490,7 @@ AST_MUTEX_DEFINE_STATIC(randomlock);
long int ast_random(void) long int ast_random(void)
{ {
long int res; long int res;
#ifdef HAVE_DEV_URANDOM
if (dev_urandom_fd >= 0) { if (dev_urandom_fd >= 0) {
int read_res = read(dev_urandom_fd, &res, sizeof(res)); int read_res = read(dev_urandom_fd, &res, sizeof(res));
if (read_res > 0) { if (read_res > 0) {
@@ -1504,7 +1500,7 @@ long int ast_random(void)
return res % rm; return res % rm;
} }
} }
#endif
/* XXX - Thread safety really depends on the libc, not the OS. /* XXX - Thread safety really depends on the libc, not the OS.
* *
* But... popular Linux libc's (uClibc, glibc, eglibc), all have a * But... popular Linux libc's (uClibc, glibc, eglibc), all have a
@@ -2035,9 +2031,7 @@ int ast_mkdir(const char *path, int mode)
int ast_utils_init(void) int ast_utils_init(void)
{ {
#ifdef HAVE_DEV_URANDOM
dev_urandom_fd = open("/dev/urandom", O_RDONLY); dev_urandom_fd = open("/dev/urandom", O_RDONLY);
#endif
base64_init(); base64_init();
#ifdef DEBUG_THREADS #ifdef DEBUG_THREADS
#if !defined(LOW_MEMORY) #if !defined(LOW_MEMORY)