diff options
author | snermolaev <snermolaev@yandex-team.ru> | 2022-02-10 16:45:53 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:53 +0300 |
commit | 2015790ac9fcc04caab83fccc23ab2460310a797 (patch) | |
tree | e644e9bc3f6f688561a871793b59bf8a637e0f72 /contrib/libs/c-ares/ares_gethostbyname.c | |
parent | c768a99151e47c3a4bb7b92c514d256abd301c4d (diff) | |
download | ydb-2015790ac9fcc04caab83fccc23ab2460310a797.tar.gz |
Restoring authorship annotation for <snermolaev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/c-ares/ares_gethostbyname.c')
-rw-r--r-- | contrib/libs/c-ares/ares_gethostbyname.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/contrib/libs/c-ares/ares_gethostbyname.c b/contrib/libs/c-ares/ares_gethostbyname.c index ecd03e7931..00962d5400 100644 --- a/contrib/libs/c-ares/ares_gethostbyname.c +++ b/contrib/libs/c-ares/ares_gethostbyname.c @@ -106,18 +106,18 @@ void ares_gethostbyname(ares_channel channel, const char *name, int family, return; /* Allocate and fill in the host query structure. */ - hquery = ares_malloc(sizeof(struct host_query)); + hquery = ares_malloc(sizeof(struct host_query)); if (!hquery) { callback(arg, ARES_ENOMEM, 0, NULL); return; } hquery->channel = channel; - hquery->name = ares_strdup(name); + hquery->name = ares_strdup(name); hquery->want_family = family; hquery->sent_family = -1; /* nothing is sent yet */ if (!hquery->name) { - ares_free(hquery); + ares_free(hquery); callback(arg, ARES_ENOMEM, 0, NULL); return; } @@ -195,14 +195,14 @@ static void host_callback(void *arg, int status, int timeouts, else if (hquery->sent_family == AF_INET6) { status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL); - if ((status == ARES_ENODATA || status == ARES_EBADRESP || - (status == ARES_SUCCESS && host && host->h_addr_list[0] == NULL)) && - hquery->want_family == AF_UNSPEC) { + if ((status == ARES_ENODATA || status == ARES_EBADRESP || + (status == ARES_SUCCESS && host && host->h_addr_list[0] == NULL)) && + hquery->want_family == AF_UNSPEC) { /* The query returned something but either there were no AAAA records (e.g. just CNAME) or the response was malformed. Try looking up A instead. */ - if (host) - ares_free_hostent(host); + if (host) + ares_free_hostent(host); hquery->sent_family = AF_INET; ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback, hquery); @@ -241,8 +241,8 @@ static void end_hquery(struct host_query *hquery, int status, hquery->callback(hquery->arg, status, hquery->timeouts, host); if (host) ares_free_hostent(host); - ares_free(hquery->name); - ares_free(hquery); + ares_free(hquery->name); + ares_free(hquery); } /* If the name looks like an IP address, fake up a host entry, end the @@ -301,7 +301,7 @@ static int fake_hostent(const char *name, int family, addrs[0] = (char *)&in6; } /* Duplicate the name, to avoid a constness violation. */ - hostent.h_name = ares_strdup(name); + hostent.h_name = ares_strdup(name); if (!hostent.h_name) { callback(arg, ARES_ENOMEM, 0, NULL); @@ -315,7 +315,7 @@ static int fake_hostent(const char *name, int family, hostent.h_addr_list = addrs; callback(arg, ARES_SUCCESS, 0, &hostent); - ares_free((char *)(hostent.h_name)); + ares_free((char *)(hostent.h_name)); return 1; } @@ -365,18 +365,18 @@ static int file_lookup(const char *name, int family, struct hostent **host) char tmp[MAX_PATH]; HKEY hkeyHosts; - if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, + if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts) == ERROR_SUCCESS) { DWORD dwLength = MAX_PATH; - RegQueryValueExA(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp, + RegQueryValueExA(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp, &dwLength); - ExpandEnvironmentStringsA(tmp, PATH_HOSTS, MAX_PATH); + ExpandEnvironmentStringsA(tmp, PATH_HOSTS, MAX_PATH); RegCloseKey(hkeyHosts); } } else if (platform == WIN_9X) - GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH); + GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH); else return ARES_ENOTFOUND; |