aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-service.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-04-12 00:10:30 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-04-12 00:10:30 +0800
commitf132c28d7f50f16f0d1fe5c93a68eb17ba6d55ac (patch)
tree9a2a78d068638605353988662cad84b7828ef37d /camel/camel-service.c
parent028643bccfc06f2e070c7bf5b7ee582c26c5d650 (diff)
downloadgsoc2013-evolution-f132c28d7f50f16f0d1fe5c93a68eb17ba6d55ac.tar.gz
gsoc2013-evolution-f132c28d7f50f16f0d1fe5c93a68eb17ba6d55ac.tar.zst
gsoc2013-evolution-f132c28d7f50f16f0d1fe5c93a68eb17ba6d55ac.zip
Check if gethostbyname_r take five params
2001-04-11 JP Rosevear <jpr@ximian.com> * configure.in: Check if gethostbyname_r take five params * acconfig.h: add GETHOSTBYNAME_R_FIVE_ARGS 2001-04-11 JP Rosevear <jpr@ximian.com> * providers/imap/Makefile.am: user GNOME_INCLUDEDIR since gnome files are included in the top level camel headers and the gtk include dir is now versioned and such * providers/local/Makefile.am: ditto * providers/pop3/Makefile.am: ditto * providers/smtp/Makefile.am: ditto * providers/sendmail/Makefile.am: ditto * camel-service.c: use five arg version of gethostbyname_r if appropriate (camel_get_host_byname): check if msg->herr is non-zero instead of checking if msg->hp is null since we may not always have msg->hp svn path=/trunk/; revision=9239
Diffstat (limited to 'camel/camel-service.c')
-rw-r--r--camel/camel-service.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/camel/camel-service.c b/camel/camel-service.c
index 1380cca4bb..8c37b0e79d 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -504,7 +504,9 @@ struct _lookup_msg {
int result;
int herr;
struct hostent hostbuf;
+#ifndef GETHOSTBYNAME_R_FIVE_ARGS
struct hostent *hp;
+#endif
int hostbuflen;
char *hostbufmem;
};
@@ -514,7 +516,11 @@ get_host(void *data)
{
struct _lookup_msg *info = data;
+#ifdef GETHOSTBYNAME_R_FIVE_ARGS
+ while (gethostbyname_r(info->name, &info->hostbuf, info->hostbufmem, info->hostbuflen, &info->herr) && info->herr == ERANGE) {
+#else
while ((info->result = gethostbyname_r(info->name, &info->hostbuf, info->hostbufmem, info->hostbuflen, &info->hp, &info->herr)) == ERANGE) {
+#endif
d(printf("gethostbyname fialed?\n"));
#ifdef ENABLE_THREADS
pthread_testcancel();
@@ -594,7 +600,7 @@ struct hostent *camel_get_host_byname(const char *name, CamelException *ex)
camel_operation_end(NULL);
- if (msg->hp == NULL) {
+ if (msg->herr) {
if (!camel_exception_is_set(ex)) {
if (msg->herr == HOST_NOT_FOUND || msg->herr == NO_DATA)
camel_exception_setv(ex, 1, _("Host lookup failed: %s: host not found"), name);