summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2012-12-14 10:48:46 +0100
committerAnand Avati <avati@redhat.com>2013-01-16 17:44:43 -0800
commitb9249c8f9f838c2a9c28e5c09fffddc9c8917df6 (patch)
tree0bb5a1010f0b4f575f7f48e700be5184e21c482c /configure.ac
parentfba70e641eb52c90fa29fc26d916e4607e286779 (diff)
Fix format security errors with hardening build flags
These problems were found while building with the hardening options used by Debian. In order to prevent introducing new unsafe constructs, the options -Wformat" and -Werror=format-security are addeded to the CFLAGS by configure.ac if the compiler supports them. Also, a small spelling fix in posix-aio.c is included. Change-Id: I1034311644fa3c21bc5a7b842c41a3ca79108b3f BUG: 887278 Original-author: Patrick Matthäi <pmatthaei@debian.org> Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/4311 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files changed, 12 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index dec146e5294..3f87a46a086 100644
--- a/configure.ac
+++ b/configure.ac
@@ -523,6 +523,18 @@ GF_HOST_OS=""
GF_LDFLAGS="-rdynamic"
CFLAGS="-g"
+# check for gcc -Werror=format-security
+saved_CFLAGS=$CFLAGS
+CFLAGS="-Wformat -Werror=format-security"
+AC_MSG_CHECKING([whether $CC accepts -Werror=format-security])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [cc_werror_format_security=yes], [cc_werror_format_security=no])
+echo $cc_werror_format_security
+if test "x$cc_werror_format_security" = "xno"; then
+ CFLAGS="$saved_CFLAGS"
+else
+ CFLAGS="$saved_CFLAGS $CFLAGS"
+fi
+
case $host_os in
linux*)
dnl GF_LINUX_HOST_OS=1