From: Todd C. Miller Date: Mon, 30 Jan 2012 15:12:14 +0000 (-0500) Subject: Add rudimentary check for _FORTIFY_SOURCE support by checking for X-Git-Tag: SUDO_1_7_9~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b122e2ad20d3cc950bc4460a18cdaa6097ce8fb8;p=sudo Add rudimentary check for _FORTIFY_SOURCE support by checking for __sprintf_chk, one of the functions used by gcc to support it. --HG-- branch : 1.7 --- diff --git a/configure b/configure index 6595092cb..ec3b88bf0 100755 --- a/configure +++ b/configure @@ -16144,6 +16144,13 @@ fi fi done +O_CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2" +ac_fn_c_check_func "$LINENO" "__sprintf_chk" "ac_cv_func___sprintf_chk" +if test "x$ac_cv_func___sprintf_chk" = xyes; then : + OSDEFS="${OSDEFS} -D_FORTIFY_SOURCE=2" +fi + +CPPFLAGS="$O_CPPFLAGS" for ac_func in getutxid getutid do : diff --git a/configure.in b/configure.in index 430b98d04..47b6e3d38 100644 --- a/configure.in +++ b/configure.in @@ -2021,6 +2021,12 @@ AC_CHECK_FUNCS(setsid, [], [ AC_LIBOBJ(setsid) AC_FUNC_SETPGRP ]) +dnl +dnl If libc supports _FORTIFY_SOURCE check functions, use it. +dnl +O_CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2" +AC_CHECK_FUNC(__sprintf_chk, [OSDEFS="${OSDEFS} -D_FORTIFY_SOURCE=2"], []) +CPPFLAGS="$O_CPPFLAGS" AC_CHECK_FUNCS(getutxid getutid, [break])