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