From 72a82284b0df4f928a226c91eaa2b327a37501db Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 13 Apr 2004 19:19:43 +0000 Subject: Implemented a similar workaround to the one I did for a gethostbyaddr_r() 2004-04-13 Jeffrey Stedfast * e-host-utils.c (e_gethostbyname_r): Implemented a similar workaround to the one I did for a gethostbyaddr_r() glibc bug here. Glibc will apparently return success for addresses such as "192..168.1.1" (note the double dot) and yet not have filled in the hostent properly. svn path=/trunk/; revision=25445 --- e-util/ChangeLog | 8 ++++++++ e-util/e-host-utils.c | 13 ++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'e-util') diff --git a/e-util/ChangeLog b/e-util/ChangeLog index ff22477bb8..0c6fb9ba90 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,11 @@ +2004-04-13 Jeffrey Stedfast + + * e-host-utils.c (e_gethostbyname_r): Implemented a similar + workaround to the one I did for a gethostbyaddr_r() glibc bug + here. Glibc will apparently return success for addresses such as + "192..168.1.1" (note the double dot) and yet not have filled in + the hostent properly. + 2004-04-12 Jeffrey Stedfast Really fixes bug #56623 diff --git a/e-util/e-host-utils.c b/e-util/e-host-utils.c index 4ca2daa6dc..bab6486e0c 100644 --- a/e-util/e-host-utils.c +++ b/e-util/e-host-utils.c @@ -247,8 +247,19 @@ e_gethostbyname_r (const char *name, struct hostent *host, int retval; retval = gethostbyname_r (name, host, buf, buflen, &hp, herr); - if (hp != NULL) + if (hp != NULL) { *herr = 0; + } else if (retval == 0) { + /* glibc 2.3.2 workaround - it seems that + * gethostbyname_r will sometimes return 0 on fail and + * not set the hostent values (hence the crash in bug + * #56337). Hopefully we can depend on @hp being NULL + * in this error case like we do with + * gethostbyaddr_r(). + */ + retval = -1; + } + return retval; #endif #else /* No support for gethostbyname_r */ -- cgit v1.2.3