[dovecot-cvs] dovecot-1.0: If getnameinfo() fails, use gai_strerror() as well ...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Jun 10 22:22:02 EEST 2007
details: http://hg.dovecot.org/dovecot-1.0/rev/48e0be9f8cbb
changeset: 5290:48e0be9f8cbb
user: Timo Sirainen <tss at iki.fi>
date: Sun Jun 10 22:21:57 2007 +0300
description:
If getnameinfo() fails, use gai_strerror() as well to return the error string.
diffstat:
1 file changed, 4 insertions(+), 9 deletions(-)
src/lib/network.c | 13 ++++---------
diffs (30 lines):
diff -r aaa2e8397de4 -r 48e0be9f8cbb src/lib/network.c
--- a/src/lib/network.c Wed May 30 15:19:19 2007 +0300
+++ b/src/lib/network.c Sun Jun 10 22:21:57 2007 +0300
@@ -445,10 +445,10 @@ int net_gethostbyname(const char *addr,
if (host_error != 0)
return host_error;
- if (getnameinfo(ai->ai_addr, ai->ai_addrlen, hbuf,
- sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
- return 1;
-
+ host_error = getnameinfo(ai->ai_addr, ai->ai_addrlen, hbuf,
+ sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
+ if (host_error != 0)
+ return host_error;
/* get number of IPs */
origai = ai;
@@ -607,11 +607,6 @@ const char *net_gethosterror(int error)
{
#ifdef HAVE_IPV6
i_assert(error != 0);
-
- if (error == 1) {
- /* getnameinfo() failed */
- return strerror(errno);
- }
return gai_strerror(error);
#else
More information about the dovecot-cvs
mailing list