aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-04-14 03:19:43 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-04-14 03:19:43 +0800
commit72a82284b0df4f928a226c91eaa2b327a37501db (patch)
tree4cc123d3ab99c4adea2b8664dd1f451ed123d4d2
parentab652676c247df51d85829108b084892c0f26bd5 (diff)
downloadgsoc2013-evolution-72a82284b0df4f928a226c91eaa2b327a37501db.tar.gz
gsoc2013-evolution-72a82284b0df4f928a226c91eaa2b327a37501db.tar.zst
gsoc2013-evolution-72a82284b0df4f928a226c91eaa2b327a37501db.zip
Implemented a similar workaround to the one I did for a gethostbyaddr_r()
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. svn path=/trunk/; revision=25445
-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 */