diff --git a/package/iproute2/0003-lib-fix-multiple-strlcpy-definition.patch b/package/iproute2/0003-lib-fix-multiple-strlcpy-definition.patch new file mode 100644 index 0000000000..05e9c38084 --- /dev/null +++ b/package/iproute2/0003-lib-fix-multiple-strlcpy-definition.patch @@ -0,0 +1,103 @@ +From 5b55bbe48a29cf6a72cef9f424835f6244e66351 Mon Sep 17 00:00:00 2001 +From: Baruch Siach +Date: Tue, 26 Sep 2017 13:45:21 +0300 +Subject: [PATCH] lib: fix multiple strlcpy definition + +Some C libraries, like uClibc and musl, provide BSD compatible +strlcpy(). Add check_strlcpy() to configure, and avoid defining strlcpy +and strlcat when the C library provides them. + +This fixes the following static link error: + +.../sysroot/usr/lib/libc.a(strlcpy.os): In function `strlcpy': +strlcpy.c:(.text+0x0): multiple definition of `strlcpy' +../lib/libutil.a(utils.o):utils.c:(.text+0x1ddc): first defined here +collect2: error: ld returned 1 exit status + +[baruch: backported from upstream submission to 4.13] +Signed-off-by: Baruch Siach +--- +Upstream status: https://patchwork.ozlabs.org/patch/819705/ +--- + configure | 24 ++++++++++++++++++++++++ + lib/Makefile | 4 ++++ + lib/utils.c | 2 ++ + 3 files changed, 30 insertions(+) + +diff --git a/configure b/configure +index 88cbdb825689..4964b998059e 100755 +--- a/configure ++++ b/configure +@@ -325,6 +325,27 @@ EOF + rm -f $TMPDIR/dbtest.c $TMPDIR/dbtest + } + ++check_strlcpy() ++{ ++ cat >$TMPDIR/strtest.c < ++int main(int argc, char **argv) { ++ char dst[10]; ++ strlcpy(dst, "test", sizeof(dst)); ++ return 0; ++} ++EOF ++ $CC -I$INCLUDE -o $TMPDIR/strtest $TMPDIR/strtest.c >/dev/null 2>&1 ++ if [ $? -eq 0 ] ++ then ++ echo "no" ++ else ++ echo "NEED_STRLCPY:=y" >>Config ++ echo "yes" ++ fi ++ rm -f $TMPDIR/strtest.c $TMPDIR/strtest ++} ++ + quiet_config() + { + cat <