]>
Commit | Line | Data |
---|---|---|
4490d623 | 1 | 2003-09-19 Jeffrey Stedfast <fejj@ximian.com> |
2 | ||
3 | * e-host-utils.c (e_gethostbyaddr_r): Work around a bug in glibc | |
4 | 2.3.2's gethostbyaddr_r() implementation. | |
5 | ||
6 | Index: evolution/e-util/e-host-utils.c | |
7 | diff -u evolution/e-util/e-host-utils.c:1.14.4.1 evolution/e-util/e-host-utils.c:1.14.4.2 | |
8 | --- evolution/e-util/e-host-utils.c:1.14.4.1 Mon Sep 29 11:39:44 2003 | |
9 | +++ evolution/e-util/e-host-utils.c Wed Oct 8 16:36:22 2003 | |
10 | @@ -337,8 +337,21 @@ | |
11 | int retval; | |
12 | ||
13 | retval = gethostbyaddr_r (addr, addrlen, type, host, buf, buflen, &hp, herr); | |
14 | - if (hp != NULL) | |
15 | + | |
16 | + if (hp != NULL) { | |
17 | *herr = 0; | |
18 | + retval = 0; | |
19 | + } else if (retval == 0) { | |
20 | + /* glibc 2.3.2 workaround - it seems that | |
21 | + * gethostbyaddr_r will sometimes return 0 on fail and | |
22 | + * fill @host with garbage strings from /etc/hosts | |
23 | + * (failure to parse the file? who knows). Luckily, it | |
24 | + * seems that we can rely on @hp being NULL on | |
25 | + * fail. | |
26 | + */ | |
27 | + retval = -1; | |
28 | + } | |
29 | + | |
30 | return retval; | |
31 | #endif | |
32 | #else /* No support for gethostbyaddr_r */ |