From 856372e04411c24a5a121e3729c5adec3daadd9b Mon Sep 17 00:00:00 2001 From: barracuda156 Date: Sun, 6 Aug 2023 16:44:32 +0800 Subject: [PATCH 3/3] Handle strlcpy.h coherently --- Makefile | 2 +- jftp.c | 3 ++- parserow.c | 3 +++ spegla.c | 3 +++ spf_util.c | 3 ++- strlcpy.h | 4 +++- 6 files changed, 14 insertions(+), 4 deletions(-) diff --git Makefile Makefile index 3743788..f2ab48f 100644 --- Makefile +++ Makefile @@ -12,7 +12,7 @@ SRCS = jftp.c parserow.c spegla.c tgetopt.c container.c spf_util.c \ regcomp.c regerror.c regexec.c regfree.c .if !(defined(HAVE_STRLCPY) && ${HAVE_STRLCPY} == "yes") SRCS += strlcpy.c -CPPFLAGS += -DNO_STRLCPY +#CPPFLAGS += -DNO_STRLCPY .endif MAN = spegla.1 diff --git jftp.c jftp.c index 34e11d2..6d8e814 100644 --- jftp.c +++ jftp.c @@ -52,7 +52,8 @@ #include #include -#ifdef NO_STRLCPY +#if !(defined(__APPLE__) && defined(__clang__)) +/* On macOS with Clang a conflict with the OS headers arises */ #include "strlcpy.h" #endif diff --git parserow.c parserow.c index 1e140bd..8c068e2 100644 --- parserow.c +++ parserow.c @@ -51,7 +51,10 @@ # define DAYSPERNYEAR 365 # endif #endif +#if !(defined(__APPLE__) && defined(__clang__)) +/* On macOS with Clang a conflict with the OS headers arises */ #include "strlcpy.h" +#endif #include "parserow.h" #include "spegla.h" diff --git spegla.c spegla.c index c731087..87997f3 100644 --- spegla.c +++ spegla.c @@ -67,7 +67,10 @@ #include #include +#if !(defined(__APPLE__) && defined(__clang__)) +/* On macOS with Clang a conflict with the OS headers arises */ #include "strlcpy.h" +#endif #include "spegla.h" #include "parserow.h" #include "jftp.h" diff --git spf_util.c spf_util.c index 3b1f937..aaae0e8 100644 --- spf_util.c +++ spf_util.c @@ -45,7 +45,8 @@ #include #include -#ifdef NO_STRLCPY +#if !(defined(__APPLE__) && defined(__clang__)) +/* On macOS with Clang a conflict with the OS headers arises */ #include "strlcpy.h" #endif diff --git strlcpy.h strlcpy.h index 20c9c3a..7c268b3 100644 --- strlcpy.h +++ strlcpy.h @@ -2,8 +2,10 @@ #ifndef STRLCPY__H #define STRLCPY__H +#if !(defined(__APPLE__) && defined(__clang__)) +/* On macOS with Clang a conflict with the OS headers arises */ size_t strlcpy(char *dst, const char *src, size_t size); size_t strlcat(char *dst, const char *src, size_t size); +#endif #endif /* STRLCPY__H */ - -- 2.41.0