[dovecot-cvs] dovecot: If getnameinfo() fails, use gai_strerror() as well to r...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Jun 10 22:22:06 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/dc8d38798296
changeset: 5673:dc8d38798296
user: Timo Sirainen <tss at iki.fi>
date: Sun Jun 10 22:21:58 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 ca38eb4189e8 -r dc8d38798296 src/lib/network.c
--- a/src/lib/network.c Mon Jun 04 14:50:50 2007 +0300
+++ b/src/lib/network.c Sun Jun 10 22:21:58 2007 +0300
@@ -435,10 +435,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;
@@ -594,11 +594,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