Re: [evolution-patches] if getaddrinfo() fails, set an exception
- From: Not Zed <notzed ximian com>
- To: Jeffrey Stedfast <fejj ximian com>
- Cc: evolution-patches ximian com
- Subject: Re: [evolution-patches] if getaddrinfo() fails, set an exception
- Date: Tue, 05 Oct 2004 10:44:16 +0800
On Mon, 2004-10-04 at 15:51 -0400, Jeffrey Stedfast wrote:
It seems that gentoo systems are broken (hold surprise) in that they
don't list "imap" in /etc/services and so gentoo suers have been getting
silent host lookup failures when using at least imap.
the attached patch will at least make it so that an exception dialog
pops up, tho we may also want to change the use of the
camel_getaddrinfo() code to use hard coded port numebrs rather than
service names? Dunno.
Not as a default, perhaps as a fallback. How could gentoo be that bloody broken though?
(Note: an earlier camel-services.c patch is included in this diff, but
since it was only a 1-line change figured it wouldn't be any trouble to
ignore)
Jeff
text/plain attachment (getaddrinfo-ex.patch)
|
? 67028.patch
? camel-tls.patch
? getaddrinfo-ex.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.2251.2.12
diff -u -r1.2251.2.12 ChangeLog
--- ChangeLog 29 Sep 2004 01:57:11 -0000 1.2251.2.12
+++ ChangeLog 4 Oct 2004 19:44:00 -0000
@@ -1,3 +1,12 @@
+2004-10-04 Jeffrey Stedfast <fejj novell com>
+
+ * camel-service.c (camel_getaddrinfo): Add a non-const cast for
+ hints when changing the ai_family member in the IPv6-disabled
+ case. Fixes bug #67028.
+ (cs_waitinfo): Set an exception if reply->result != 0. Also fixed
+ the "cannot create thread" case (was missing a printf-style
+ argument to setv).
+
2004-09-28 Not Zed <NotZed Ximian com>
** See bug #66509.
Index: camel-service.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-service.c,v
retrieving revision 1.90.14.1
diff -u -r1.90.14.1 camel-service.c
--- camel-service.c 23 Sep 2004 04:12:29 -0000 1.90.14.1
+++ camel-service.c 4 Oct 2004 19:44:01 -0000
@@ -31,7 +31,11 @@
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
#include <pthread.h>
+#include <netdb.h>
#include <errno.h>
#include <sys/poll.h>
@@ -737,9 +741,31 @@
d(printf("waiting for child to exit\n"));
pthread_join(id, NULL);
d(printf("child done\n"));
+
+ if (reply->result != 0) {
+ const char *hostaddr;
+ char ntopbuf[50];
+
+ if (reply->name) {
+ hostaddr = reply->name;
+ } else if (reply->addr->sa_family == AF_INET) {
+ hostaddr = inet_ntop (AF_INET, &((struct sockaddr_in *) reply->addr)->sin_addr,
+ ntopbuf, sizeof (ntopbuf));
+#ifdef ENABLE_IPv6
+ } else if (reply->addr->sa_family == AF_INET6) {
+ hostaddr = inet_ntop (AF_INET6, &((struct sockaddr_in6 *) reply->addr)->sin6_addr,
+ ntopbuf, sizeof (ntopbuf));
+#endif /* ENABLE_Ipv6 */
+ } else {
+ hostaddr = "unknown address";
+ }
You shoudn't be doing any of this. The whole point of the getaddrinfo patch is to REMOVE any of this ipv4 vs ipv6 specific stuff in the code.
And you can't really provide a proper error in this place anyway, since its a generic routine. It should be handled in the public entry points, since they have more context. You've implictly added knowledge of its callers here.
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "%s: %s: %s", error,
+ hostaddr, gai_strerror (reply->result));
+ }
}
} else {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "%s: %s: %s", _("cannot create thread"), g_strerror(err));
+ camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM, "%s: %s: %s", error, _("cannot create thread"), g_strerror(err));
this is good though, thanks for spotting it.
}
e_msgport_destroy(reply_port);
@@ -897,7 +923,7 @@
hints = &myhints;
}
- hints->ai_family = AF_INET;
+ ((struct addrinfo *) hints)->ai_family = AF_INET;
#endif
msg = g_malloc0(sizeof(*msg));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]