aboutsummaryrefslogtreecommitdiffstats
path: root/KAME/getnameinfo.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2006-05-15 10:59:45 +0000
committerMatthias Andree <matthias.andree@gmx.de>2006-05-15 10:59:45 +0000
commitf9db9985e1a0a2da0f21fc3dbfd92bf12f924d1e (patch)
tree6b280d8ca1c19b7659a96b0d5c8ffe2ea8f58d52 /KAME/getnameinfo.c
parent7b3f2a442d6ccfc9bffd0e43dc2116f4725e8146 (diff)
downloadfetchmail-f9db9985e1a0a2da0f21fc3dbfd92bf12f924d1e.tar.gz
fetchmail-f9db9985e1a0a2da0f21fc3dbfd92bf12f924d1e.tar.bz2
fetchmail-f9db9985e1a0a2da0f21fc3dbfd92bf12f924d1e.zip
* Improve KAME/getnameinfo.c portability to Linux libc5 systems.
Based on a patch by Dan Fandrich. * Provide INET6 to KAME/getnameinfo.c (only useful on IPv6-enabled systems that lack getnameinfo, and there only visible in some Received: headers). Found by Dan Fandrich. svn path=/branches/BRANCH_6-3/; revision=4839
Diffstat (limited to 'KAME/getnameinfo.c')
-rw-r--r--KAME/getnameinfo.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/KAME/getnameinfo.c b/KAME/getnameinfo.c
index 9549600c..fb97530e 100644
--- a/KAME/getnameinfo.c
+++ b/KAME/getnameinfo.c
@@ -71,7 +71,9 @@
#include <stddef.h>
#include <errno.h>
+#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
+#endif
#include "fetchmail.h"
#include "getaddrinfo.h"
@@ -284,9 +286,16 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
}
#endif
default:
+#ifdef HAVE_INET_NTOP
if (inet_ntop(afd->a_af, addr, host,
hostlen) == NULL)
return EAI_SYSTEM;
+#else
+ if (afd->a_af == AF_INET)
+ strlcpy(host, inet_ntoa(addr), hostlen);
+ else
+ return EAI_FAMILY;
+#endif
break;
}
}