- Fix to define _OPENBSD_SOURCE to get reallocarray on NetBSD.

This commit is contained in:
W.C.A. Wijngaards 2019-05-28 11:12:05 +02:00
parent a03f0a388e
commit 14b11384a4
4 changed files with 48 additions and 8 deletions

View file

@ -413,7 +413,7 @@
/* Define to 1 if you have the `RAND_cleanup' function. */ /* Define to 1 if you have the `RAND_cleanup' function. */
#undef HAVE_RAND_CLEANUP #undef HAVE_RAND_CLEANUP
/* Define to 1 if you have the `reallocarray' function. */ /* If we have reallocarray(3) */
#undef HAVE_REALLOCARRAY #undef HAVE_REALLOCARRAY
/* Define to 1 if you have the `recvmsg' function. */ /* Define to 1 if you have the `recvmsg' function. */

34
configure vendored
View file

@ -20144,20 +20144,42 @@ fi
LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS" LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
ac_fn_c_check_func "$LINENO" "reallocarray" "ac_cv_func_reallocarray" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for reallocarray" >&5
if test "x$ac_cv_func_reallocarray" = xyes; then : $as_echo_n "checking for reallocarray... " >&6; }
$as_echo "#define HAVE_REALLOCARRAY 1" >>confdefs.h cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
#define _OPENBSD_SOURCE 1
#include <stdlib.h>
int main(void) {
void* p = reallocarray(NULL, 10, 100);
free(p);
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_REALLOCARRAY 1" >>confdefs.h
else else
case " $LIBOBJS " in
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
case " $LIBOBJS " in
*" reallocarray.$ac_objext "* ) ;; *" reallocarray.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS reallocarray.$ac_objext" *) LIBOBJS="$LIBOBJS reallocarray.$ac_objext"
;; ;;
esac esac
fi fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test "$USE_NSS" = "no"; then if test "$USE_NSS" = "no"; then
ac_fn_c_check_func "$LINENO" "arc4random" "ac_cv_func_arc4random" ac_fn_c_check_func "$LINENO" "arc4random" "ac_cv_func_arc4random"
if test "x$ac_cv_func_arc4random" = xyes; then : if test "x$ac_cv_func_arc4random" = xyes; then :

View file

@ -1447,7 +1447,22 @@ AC_REPLACE_FUNCS(explicit_bzero)
dnl without CTIME, ARC4-functions and without reallocarray. dnl without CTIME, ARC4-functions and without reallocarray.
LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS" LIBOBJ_WITHOUT_CTIMEARC4="$LIBOBJS"
AC_SUBST(LIBOBJ_WITHOUT_CTIMEARC4) AC_SUBST(LIBOBJ_WITHOUT_CTIMEARC4)
AC_REPLACE_FUNCS(reallocarray) AC_MSG_CHECKING([for reallocarray])
AC_LINK_IFELSE([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT
[[
#define _OPENBSD_SOURCE 1
#include <stdlib.h>
int main(void) {
void* p = reallocarray(NULL, 10, 100);
free(p);
return 0;
}
]])], [AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_REALLOCARRAY, 1, [If we have reallocarray(3)])
], [
AC_MSG_RESULT(no)
AC_LIBOBJ(reallocarray)
])
if test "$USE_NSS" = "no"; then if test "$USE_NSS" = "no"; then
AC_REPLACE_FUNCS(arc4random) AC_REPLACE_FUNCS(arc4random)
AC_REPLACE_FUNCS(arc4random_uniform) AC_REPLACE_FUNCS(arc4random_uniform)

View file

@ -1,3 +1,6 @@
28 May 2019: Wouter
- Fix to define _OPENBSD_SOURCE to get reallocarray on NetBSD.
27 May 2019: Wouter 27 May 2019: Wouter
- Fix double file close in tcp pipelined response code. - Fix double file close in tcp pipelined response code.