aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e-util/ChangeLog8
-rw-r--r--e-util/e-host-utils.c13
2 files changed, 20 insertions, 1 deletions
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 <fejj@ximian.com>
+
+ * 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 <fejj@ximian.com>
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 */