The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1634

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
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 <[email protected]>
From 89e4cd19c4c05e53e7f997718a0c87f2aa52adb0 Mon Sep 17 00:00:00 2001
From: Dengke Du <[email protected]>
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 <[email protected]>
---
 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
 
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to