On 3/25/24 9:25 AM, Vladimir Petko wrote:
  strlcpy and strlcat were introduced in glibc 2.38[1]. At the moment
Ubuntu noble has 2.39  and Debian unstable  - 2.37.

Can you try the attached patch which patches CMakeLists.txt to add the definition when strlcat/strlcpy are found on Linux?

Kind Regards,

Bas

--
 GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
Description: Add -D_BSD_SOURCE for strlcat/strlcpy privided by glibc >= 2.38.
Author: Bas Couwenberg <sebas...@debian.org>
Bug-Debian: https://bugs.debian.org/1067651

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,6 +121,10 @@ check_function_exists("strlcpy"  HAVE_ST
 check_function_exists("strlen"  HAVE_STRLEN)
 check_function_exists("strncasecmp"  HAVE_STRNCASECMP)
 
+IF((HAVE_STRLCAT OR HAVE_STRLCPY) AND CMAKE_SYSTEM_NAME MATCHES "Linux")
+    add_definition(-D_BSD_SOURCE)
+ENDIF
+
 check_symbol_exists(vsnprintf stdio.h HAVE_VSNPRINTF)
 IF(NOT HAVE_VSNPRINTF)
     check_function_exists("vsnprintf"  HAVE_VSNPRINTF)

Reply via email to