[lxc-devel] [lxc/master] lxc: let it compile ok for gcc7
DengkeDu on Github
lxc-bot at linuxcontainers.org
Thu Jun 22 08:41:25 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 967 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170622/928b44f4/attachment.bin>
-------------- next part --------------
From 89e4cd19c4c05e53e7f997718a0c87f2aa52adb0 Mon Sep 17 00:00:00 2001
From: Dengke Du <dengke.du at windriver.com>
Date: Thu, 22 Jun 2017 07:33:12 +0000
Subject: [PATCH] lxc: let it compile ok for gcc7
After gcc upgrade to 7.1, gcc7 contains a number of enhancements that help
detect buffer overflow and other forms of invalid memory accesses.
When compiling lxc with gcc7, the system outputs errors:
../../../lxc-2.0.4/src/lxc/bdev/lxcloop.c:297:30: error: '%s' directive
output may be truncated writing up to 255 bytes into a region of size 95
[-Werror=format-truncation=]
This is because in configure.ac, the flag "-Werror" let the compiler treat
the warnings as errors, in order to compile successfully, we should add the
following to the configure.ac:
-Wno-error=format-truncation
Signed-off-by: Dengke Du <dengke.du at windriver.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 0e29cb9d9..403d522bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -686,7 +686,7 @@ LXC_CHECK_TLS
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Wall"
if test "x$enable_werror" = "xyes"; then
- CFLAGS="$CFLAGS -Werror"
+ CFLAGS="$CFLAGS -Werror -Wno-error=format-truncation"
fi
fi
More information about the lxc-devel
mailing list