# HG changeset patch # User Daniel Atallah # Date 1135012575 0 # Node ID 3f895385e84123fcfdf9f9f447ea0b227174e155 # Parent 01e18ead06a09c0cdd2bc709c6928b9b3356dc1e [gaim-migrate @ 14884] Don't assume that gethostbyname() was successful. This should fix #1384291. committer: Tailor Script diff -r 01e18ead06a0 -r 3f895385e841 src/protocols/simple/simple.c --- a/src/protocols/simple/simple.c Mon Dec 19 17:06:59 2005 +0000 +++ b/src/protocols/simple/simple.c Mon Dec 19 17:16:15 2005 +0000 @@ -1239,6 +1239,12 @@ } else { /* UDP */ gaim_debug_info("simple", "using udp with server %s and port %d\n", hostname, port); + + /** TODO: this should probably be async, right? */ + if (!(h = gethostbyname(hostname))) { + gaim_connection_error(sip->gc, _("Couldn't resolve host")); + } + sip->fd = socket(AF_INET, SOCK_DGRAM, 0); addr.sin_family = AF_INET; @@ -1254,7 +1260,6 @@ sip->serveraddr.sin_family = AF_INET; sip->serveraddr.sin_port = htons(port); - h = gethostbyname(hostname); sip->serveraddr.sin_addr.s_addr = ((struct in_addr*)h->h_addr)->s_addr; sip->ip = g_strdup(gaim_network_get_my_ip(sip->listenfd)); sip->resendtimeout = gaim_timeout_add(2500, (GSourceFunc)resend_timeout, sip);