iptables: bump to version 1.6.1
[buildroot-gz.git] / package / logrotate / 0002-Use-autoconf-checks-for-strndup-and-asprintf.patch
blob14efc1d359849ef3218bbb3e591861b76d67e68b
1 From e626f4ca5169036a0042e55e58aca2bb5cc19ad7 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Fri, 19 Aug 2016 22:39:17 +0200
4 Subject: [PATCH] Use autoconf checks for strndup and asprintf
6 The current code in config.c can provide its own implementation of
7 asprintf() and strndup() if not provided by the system. However, in
8 order to decide if they should be provided, the check done is:
10 #if !defined(name_of_function)
12 which only works if the function is actually defined as a macro, which
13 is not necessarily the case.
15 Therefore, we replace this logic by a proper AC_CHECK_FUNCS() check in
16 the configure script.
18 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
19 ---
20 config.c | 4 ++--
21 configure.ac | 2 ++
22 2 files changed, 4 insertions(+), 2 deletions(-)
24 diff --git a/config.c b/config.c
25 index 8731348..8741e48 100644
26 --- a/config.c
27 +++ b/config.c
28 @@ -45,7 +45,7 @@
29 #include "asprintf.c"
30 #endif
32 -#if !defined(asprintf) && !defined(_FORTIFY_SOURCE)
33 +#if !defined(HAVE_ASPRINTF) && !defined(_FORTIFY_SOURCE)
34 #include <stdarg.h>
36 int asprintf(char **string_ptr, const char *format, ...)
37 @@ -78,7 +78,7 @@ int asprintf(char **string_ptr, const char *format, ...)
39 #endif
41 -#if !defined(strndup)
42 +#if !defined(HAVE_STRNDUP)
43 char *strndup(const char *s, size_t n)
45 size_t nAvail;
46 diff --git a/configure.ac b/configure.ac
47 index 5c83d20..51da52a 100644
48 --- a/configure.ac
49 +++ b/configure.ac
50 @@ -18,6 +18,8 @@ AC_SYS_LARGEFILE
51 AC_CHECK_LIB([popt],[poptParseArgvString],,
52 AC_MSG_ERROR([libpopt required but not found]))
54 +AC_CHECK_FUNCS([strndup asprintf])
56 dnl Needed for out-of-source builds
57 mkdir -p test
59 --
60 2.7.4