aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-host-utils.c
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 /e-util/e-host-utils.c
parentab652676c247df51d85829108b084892c0f26bd5 (diff)
downloadgsoc2013-evolution-72a82284b0df4f928a226c91eaa2b327a37501db.tar
gsoc2013-evolution-72a82284b0df4f928a226c91eaa2b327a37501db.tar.gz
gsoc2013-evolution-72a82284b0df4f928a226c91eaa2b327a37501db.tar.bz2
gsoc2013-evolution-72a82284b0df4f928a226c91eaa2b327a37501db.tar.lz
gsoc2013-evolution-72a82284b0df4f928a226c91eaa2b327a37501db.tar.xz
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
Diffstat (limited to 'e-util/e-host-utils.c')
-rw-r--r--e-util/e-host-utils.c13
1 files changed, 12 insertions, 1 deletions
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 */