Created
July 14, 2015 09:05
-
-
Save jantore/b78659338838367b98f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <dlfcn.h> | |
#include <netdb.h> | |
#include <string.h> | |
typedef int (*getaddrinfo_t)(const char *node, const char *service, | |
const struct addrinfo *hints, | |
struct addrinfo **res); | |
int getaddrinfo(const char *node, const char *service, | |
const struct addrinfo *hints, | |
struct addrinfo **res) | |
{ | |
struct addrinfo new_hints; | |
memcpy(&new_hints, hints, sizeof(struct addrinfo)); | |
new_hints.ai_family = AF_INET; | |
getaddrinfo_t gai; | |
gai = (getaddrinfo_t)dlsym(RTLD_NEXT, "getaddrinfo"); | |
return gai(node, service, &new_hints, res); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment