summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2019-07-16 09:20:23 +1000
committerDarren Tucker <dtucker@dtucker.net>2019-07-16 09:21:20 +1000
commit45478898f9590b5cc8bc7104e573b84be67443b0 (patch)
treea336573c93d4252ec4d03c1d4fba0356b5e72464 /openbsd-compat
parentc7bd4617293a903bd3fac3394a7e72d439af49a5 (diff)
Hook memmem compat code into build.
This fixes builds on platforms that don't have it (at least old DragonFly, probably others).
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/Makefile.in1
-rw-r--r--openbsd-compat/memmem.c5
-rw-r--r--openbsd-compat/openbsd-compat.h4
3 files changed, 10 insertions, 0 deletions
diff --git a/openbsd-compat/Makefile.in b/openbsd-compat/Makefile.in
index 2cc34363..1162dc55 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 823443b0..3e5e6b5e 100644
--- a/openbsd-compat/memmem.c
+++ b/openbsd-compat/memmem.c
@@ -27,6 +27,10 @@
* SUCH DAMAGE.
*/
+#include "includes.h"
+
+#ifndef HAVE_MEMMEM
+
#include <string.h>
/*
@@ -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 86d45317..fda6706f 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