Fix arc4random_buf(3) detection. Noticed by Eric Engestrom on

the xorg-devel list. Thanks
This commit is contained in:
matthieu 2017-03-01 19:22:36 +00:00
parent da8f098a38
commit 2666ed3f9e
4 changed files with 16 additions and 3 deletions

12
xserver/configure vendored
View File

@ -22127,7 +22127,6 @@ esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for arc4random_buf in -lbsd" >&5
$as_echo_n "checking for arc4random_buf in -lbsd... " >&6; }
if ${ac_cv_lib_bsd_arc4random_buf+:} false; then :
@ -22173,6 +22172,17 @@ _ACEOF
fi
for ac_func in arc4random_buf
do :
ac_fn_c_check_func "$LINENO" "arc4random_buf" "ac_cv_func_arc4random_buf"
if test "x$ac_cv_func_arc4random_buf" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_ARC4RANDOM_BUF 1
_ACEOF
fi
done
ac_fn_c_check_decl "$LINENO" "program_invocation_short_name" "ac_cv_have_decl_program_invocation_short_name" "#include <errno.h>
"

View File

@ -222,8 +222,8 @@ AC_CHECK_FUNCS([backtrace ffs geteuid getuid issetugid getresuid \
walkcontext])
AC_REPLACE_FUNCS([reallocarray strcasecmp strcasestr strlcat strlcpy strndup \
timingsafe_memcmp])
AC_CHECK_LIB([bsd], [arc4random_buf])
AC_CHECK_FUNCS([arc4random_buf])
AC_CHECK_DECLS([program_invocation_short_name], [], [], [[#include <errno.h>]])

View File

@ -138,6 +138,9 @@
/* Use Windows sockets */
#undef HAS_WINSOCK
/* Define to 1 if you have the `arc4random_buf' function. */
#undef HAVE_ARC4RANDOM_BUF
/* Define to 1 if you have the `authdes_create' function. */
#undef HAVE_AUTHDES_CREATE

View File

@ -305,7 +305,7 @@ GenerateAuthorization(unsigned name_length,
void
GenerateRandomData(int len, char *buf)
{
#ifndef HAVE_ARC4RANDOMBUF
#ifndef HAVE_ARC4RANDOM_BUF
int fd;
fd = open("/dev/urandom", O_RDONLY);