aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Rahul Bedarkar <rahul.bedarkar@imgtec.com>2016-08-19 22:45:03 +0530
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-08-19 22:55:24 +0200
commitf827fada63ccdcef848eade7c97572536b41677b (patch)
tree28c70a26433e381484945a2782085770cc52a089
parent52307f7b4298794e75dff39dde0557a26eae508d (diff)
downloadbuildroot-f827fada63ccdcef848eade7c97572536b41677b.tar.gz
buildroot-f827fada63ccdcef848eade7c97572536b41677b.tar.bz2
logrotate: fix build with gcc 6
With gcc version 6, we get the following error when building logrotate: logrotate.c: In function 'postrotateSingleLog': logrotate.c:1784:5: error: this 'if' clause does not guard... [-Werror=misleading-indentation] if (!state->doRotate) ^~ logrotate.c:1787:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' if (!hasErrors && log->flags & LOG_FLAG_TMPFILENAME) { ^~ This is fixed by grabbing an upstream commit, 6a36c105587b07ad14fc937f3ee6e2eb402621a2. Once this is fixed, we get: config.c: In function 'strndup': config.c:87:10: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare] if(!s) ^ cc1: all warnings being treated as errors make[2]: *** [config.o] Error 1 make[2]: *** Waiting for unfinished jobs.... cc1: all warnings being treated as errors make[2]: *** [logrotate.o] Error 1 This is due to logrotate providing its own implementation of strndup(). We could fix it, but it much better to simply use the one provided by the C library, by fixing the detection method for strndup availability. This is done in patch 0002-Use-autoconf-checks-for-strndup-and-asprintf.patch. Fixes: http://autobuild.buildroot.net/results/6dc2eb22104076920d77425b1e608ef9b9e01c94/ Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com> [Thomas: replace fix for the nonnull issue with a different one.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r--package/logrotate/0002-Use-autoconf-checks-for-strndup-and-asprintf.patch61
-rw-r--r--package/logrotate/logrotate.hash1
-rw-r--r--package/logrotate/logrotate.mk1
3 files changed, 63 insertions, 0 deletions
diff --git a/package/logrotate/0002-Use-autoconf-checks-for-strndup-and-asprintf.patch b/package/logrotate/0002-Use-autoconf-checks-for-strndup-and-asprintf.patch
new file mode 100644
index 0000000000..ed32098217
--- /dev/null
+++ b/package/logrotate/0002-Use-autoconf-checks-for-strndup-and-asprintf.patch
@@ -0,0 +1,61 @@
+From 24fd7f81f9966071717f6a0effe8190310f1b393 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Fri, 19 Aug 2016 22:39:17 +0200
+Subject: [PATCH] Use autoconf checks for strndup and asprintf
+
+The current code in config.c can provide its own implementation of
+asprintf() and strndup() if not provided by the system. However, in
+order to decide if they should be provided, the check done is:
+
+ #if !defined(name_of_function)
+
+which only works if the function is actually defined as a macro, which
+is not necessarily the case.
+
+Therefore, we replace this logic by a proper AC_CHECK_FUNCS() check in
+the configure script.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ config.c | 4 ++--
+ configure.ac | 2 ++
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/config.c b/config.c
+index dbbf563..2209afd 100644
+--- a/config.c
++++ b/config.c
+@@ -45,7 +45,7 @@
+ #include "asprintf.c"
+ #endif
+
+-#if !defined(asprintf) && !defined(_FORTIFY_SOURCE)
++#if !defined(HAVE_ASPRINTF) && !defined(_FORTIFY_SOURCE)
+ #include <stdarg.h>
+
+ int asprintf(char **string_ptr, const char *format, ...)
+@@ -78,7 +78,7 @@ int asprintf(char **string_ptr, const char *format, ...)
+
+ #endif
+
+-#if !defined(strndup)
++#if !defined(HAVE_STRNDUP)
+ char *strndup(const char *s, size_t n)
+ {
+ size_t nAvail;
+diff --git a/configure.ac b/configure.ac
+index e655b85..73b98da 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -13,6 +13,8 @@ AC_STRUCT_ST_BLOCKS
+ AC_CHECK_LIB([popt],[poptParseArgvString],,
+ AC_MSG_ERROR([libpopt required but not found]))
+
++AC_CHECK_FUNCS([strndup asprintf])
++
+ AC_ARG_WITH([selinux],
+ [AS_HELP_STRING([--with-selinux],
+ [support handling SELinux contexts (yes,no,check) @<:@default=check@:>@])],
+--
+2.7.4
+
diff --git a/package/logrotate/logrotate.hash b/package/logrotate/logrotate.hash
index 77d4dc8077..8dee715658 100644
--- a/package/logrotate/logrotate.hash
+++ b/package/logrotate/logrotate.hash
@@ -1,2 +1,3 @@
# Locally calculated
sha256 2de00c65e23fa9d7909cae6594e550b9abe9a7eb1553669ddeaca92d30f97009 logrotate-3.9.2.tar.gz
+sha256 e0d360908ac506e02f08fa1ad70e17d6985045d8640f383fef8f322886d6e1e1 6a36c105587b07ad14fc937f3ee6e2eb402621a2.patch
diff --git a/package/logrotate/logrotate.mk b/package/logrotate/logrotate.mk
index de4d837cad..38f183c37a 100644
--- a/package/logrotate/logrotate.mk
+++ b/package/logrotate/logrotate.mk
@@ -13,6 +13,7 @@ LOGROTATE_DEPENDENCIES = popt host-pkgconf
LOGROTATE_AUTORECONF = YES
LOGROTATE_CONF_ENV = LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs popt`"
LOGROTATE_CONF_OPTS = --without-selinux
+LOGROTATE_PATCH = https://github.com/logrotate/logrotate/commit/6a36c105587b07ad14fc937f3ee6e2eb402621a2.patch
ifeq ($(BR2_PACKAGE_ACL),y)
LOGROTATE_DEPENDENCIES += acl