fix compilation with openbsd

openbsd
rofl0r 2015-04-06 17:57:09 +01:00
parent 377b474b40
commit 44ca9ca968
2 changed files with 9 additions and 1 deletions

5
configure vendored
View File

@ -14,6 +14,10 @@ isbsd() {
uname -s | grep BSD >/dev/null
}
isopenbsd() {
uname -s | grep OpenBSD >/dev/null
}
usage() {
echo "supported arguments"
echo "--prefix=/path default: $prefix"
@ -104,6 +108,7 @@ if ismac ; then
elif isbsd ; then
echo LIBDL=>>config.mak
echo "CFLAGS+=-DIS_BSD">>config.mak
isopenbsd && echo "CFLAGS+=-DIS_OPENBSD">>config.mak
make_cmd=gmake
fi

View File

@ -785,7 +785,7 @@ void proxy_freeaddrinfo(struct addrinfo *res) {
free(res);
}
#ifdef IS_MAC
#if defined(IS_MAC) || defined(IS_OPENBSD)
/* getservbyname on mac is using thread local storage, so we dont need mutex */
static int getservbyname_r(const char* name, const char* proto, struct servent* result_buf,
char* buf, size_t buflen, struct servent** result) {
@ -853,6 +853,9 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
p->ai_flags = hints->ai_flags;
p->ai_protocol = hints->ai_protocol;
} else {
#ifndef AI_V4MAPPED
#define AI_V4MAPPED 0
#endif
p->ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG);
}