diff options
author | Pavel Šimerda <psimerda@redhat.com> | 2015-06-12 06:51:28 +0200 |
---|---|---|
committer | David Heidelberg <david@ixit.cz> | 2015-06-18 00:45:02 +0200 |
commit | 37953bfbe4bd1b4c2be26d837dcfa2934d5a4e16 (patch) | |
tree | b4794da4d93a0f69b3b3dbb758dfe410744f2ab4 /ninfod | |
parent | 8d6b07fe55a26cc721f67524aa8a316078971f19 (diff) | |
download | iputils-37953bfbe4bd1b4c2be26d837dcfa2934d5a4e16.tar.gz |
make `getaddrinfo()` and `getnameinfo()` usage consistent
Use modern name resolution functions and use them in a consistent
manner.
* Avoid obsolete `gethostbyname()`, `gethostbyname2()` and `gethostbyaddr()`
* Maintain consistency in variable names and error messages
* Leave IDN handling up to name resolution functions
Note: This patch provides a primitive translation of calls to obsolete
functions to calls to modern functions but more changes are needed to
process the whole result lists instead of using just the first result.
Note: This patch skips functions that use jumps to avoid making more
damage than benefits.
Diffstat (limited to 'ninfod')
-rw-r--r-- | ninfod/ninfod.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ninfod/ninfod.c b/ninfod/ninfod.c index 5ff6993..14f53bd 100644 --- a/ninfod/ninfod.c +++ b/ninfod/ninfod.c @@ -705,7 +705,7 @@ int main (int argc, char **argv) struct icmp6_hdr *icmph; #if ENABLE_DEBUG char saddrbuf[NI_MAXHOST]; - int gni; + int status; #endif init_core(0); @@ -734,12 +734,12 @@ int main (int argc, char **argv) } #if ENABLE_DEBUG - gni = getnameinfo((struct sockaddr *)&p->addr, + status = getnameinfo((struct sockaddr *)&p->addr, p->addrlen, saddrbuf, sizeof(saddrbuf), NULL, 0, NI_NUMERICHOST); - if (gni) + if (status) sprintf(saddrbuf, "???"); #endif init_core(0); |