From 45478898f9590b5cc8bc7104e573b84be67443b0 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Tue, 16 Jul 2019 09:20:23 +1000 Subject: [PATCH] Hook memmem compat code into build. This fixes builds on platforms that don't have it (at least old DragonFly, probably others). --- configure.ac | 1 + openbsd-compat/Makefile.in | 1 + openbsd-compat/memmem.c | 5 +++++ openbsd-compat/openbsd-compat.h | 4 ++++ 4 files changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index 958e99fd4..63e017733 100644 --- a/configure.ac +++ b/configure.ac @@ -1751,6 +1751,7 @@ AC_CHECK_FUNCS([ \ llabs \ login_getcapbool \ md5_crypt \ + memmem \ memmove \ memset_s \ mkdtemp \ diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in index 2cc343636..1162dc550 100644 --- a/openbsd-compat/Makefile.in +++ b/openbsd-compat/Makefile.in @@ -34,6 +34,7 @@ OPENBSD=base64.o \ inet_ntoa.o \ inet_ntop.o \ md5.o \ + memmem.o \ mktemp.o \ pwcache.o \ readpassphrase.o \ diff --git a/openbsd-compat/memmem.c b/openbsd-compat/memmem.c index 823443b08..3e5e6b5e6 100644 --- a/openbsd-compat/memmem.c +++ b/openbsd-compat/memmem.c @@ -27,6 +27,10 @@ * SUCH DAMAGE. */ +#include "includes.h" + +#ifndef HAVE_MEMMEM + #include /* @@ -62,3 +66,4 @@ memmem(const void *l, size_t l_len, const void *s, size_t s_len) return NULL; } DEF_WEAK(memmem); +#endif /* HAVE_MEMMEM */ diff --git a/openbsd-compat/openbsd-compat.h b/openbsd-compat/openbsd-compat.h index 86d45317b..fda6706f8 100644 --- a/openbsd-compat/openbsd-compat.h +++ b/openbsd-compat/openbsd-compat.h @@ -73,6 +73,10 @@ int getpagesize(void); char *getcwd(char *pt, size_t size); #endif +#ifdef HAVE_MEMMEM +void *memmem(const void *, size_t, const void *, size_t); +#endif + #ifndef HAVE_REALLOCARRAY void *reallocarray(void *, size_t, size_t); #endif