mirror of
https://github.com/rofl0r/proxychains-ng
synced 2025-01-08 22:22:52 +08:00
core.c: add getservbyname_r replacement function for mac
This commit is contained in:
parent
0f1bc719fd
commit
108610e30e
19
src/core.c
19
src/core.c
@ -841,6 +841,25 @@ void proxy_freeaddrinfo(struct addrinfo *res) {
|
|||||||
free(res);
|
free(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef IS_MAC
|
||||||
|
/* 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) {
|
||||||
|
struct servent *res;
|
||||||
|
int ret;
|
||||||
|
(void) buf; (void) buflen;
|
||||||
|
res = getservbyname(name, proto);
|
||||||
|
if(res) {
|
||||||
|
*result_buf = *res;
|
||||||
|
*result = result_buf;
|
||||||
|
ret = 0;
|
||||||
|
} else {
|
||||||
|
*result = NULL;
|
||||||
|
ret = ENOENT;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int proxy_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) {
|
int proxy_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res) {
|
||||||
struct gethostbyname_data ghdata;
|
struct gethostbyname_data ghdata;
|
||||||
|
Loading…
Reference in New Issue
Block a user