Hook memmem compat code into build.

This fixes builds on platforms that don't have it (at least old DragonFly,
probably others).
This commit is contained in:
Darren Tucker 2019-07-16 09:20:23 +10:00
parent c7bd461729
commit 45478898f9
4 changed files with 11 additions and 0 deletions

View File

@ -1751,6 +1751,7 @@ AC_CHECK_FUNCS([ \
llabs \
login_getcapbool \
md5_crypt \
memmem \
memmove \
memset_s \
mkdtemp \

View File

@ -34,6 +34,7 @@ OPENBSD=base64.o \
inet_ntoa.o \
inet_ntop.o \
md5.o \
memmem.o \
mktemp.o \
pwcache.o \
readpassphrase.o \

View File

@ -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 */

View File

@ -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