diff mbox series

[3/3] Build with libbsd for strlcpy

Message ID 20201229153556.22996-4-bage@linutronix.de
State Rejected
Headers show
Series Build with libbsd for strlcpy | expand

Commit Message

Bastian Germann Dec. 29, 2020, 3:35 p.m. UTC
From: Bastian Germann <bage@linutronix.de>

The previously included strlcpy implementation can conflict with libbsd
if REMOTE_HANDLER is enabled and zeromq is built with libbsd.

On Linux, build with libbsd to get rid of that error:
handlers/built-in.o: undefined reference to symbol 'strlcpy@@LIBBSD_0.0'

Link: https://salsa.debian.org/debian/swupdate/-/jobs/1288597
Signed-off-by: Bastian Germann <bage@linutronix.de>
---
 Makefile.flags          | 3 +++
 doc/source/swupdate.rst | 1 +
 include/util.h          | 1 +
 3 files changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/Makefile.flags b/Makefile.flags
index 7003af1..783cb89 100644
--- a/Makefile.flags
+++ b/Makefile.flags
@@ -101,6 +101,9 @@  KBUILD_CFLAGS += --sysroot=$(CONFIG_SYSROOT)
 export SYSROOT=$(CONFIG_SYSROOT)
 endif
 
+ifeq ($(HAVE_LINUX),y)
+LDLIBS += bsd
+endif
 # Links always pthread
 LDLIBS += pthread
 # lua
diff --git a/doc/source/swupdate.rst b/doc/source/swupdate.rst
index a8144d1..ede3b10 100644
--- a/doc/source/swupdate.rst
+++ b/doc/source/swupdate.rst
@@ -210,6 +210,7 @@  There are only a few libraries that are required to compile SWUpdate.
 - openssl / wolfssl / mbedtls (optional) for cryptographic operations
 - p11-kit & wolfssl (optional) for PKCS#11 support
 - Lua: liblua and the development headers.
+- libbsd is linked on Linux.
 - libz is always linked.
 - libconfig (optional) for the default parser
 - libarchive (optional) for archive handler
diff --git a/include/util.h b/include/util.h
index e5a8955..d6df2b8 100644
--- a/include/util.h
+++ b/include/util.h
@@ -13,6 +13,7 @@ 
 #include <string.h>
 #include <stdio.h>
 #if defined(__linux__)
+#include <bsd/string.h>
 #include <linux/types.h>
 #endif
 #include "swupdate.h"