Mercurial > pidgin
changeset 31734:f71b6a715cc7
Fix some closes on invalid fds, which can crash on Windows.
committer: Ethan Blanton <elb@pidgin.im>
author | Florian Quèze <florian@instantbird.org> |
---|---|
date | Sun, 10 Jul 2011 13:11:36 +0000 |
parents | c44f896d2676 |
children | 7d08ac041588 |
files | libpurple/protocols/simple/simple.c libpurple/upnp.c |
diffstat | 2 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/simple/simple.c Sat Jul 09 22:34:25 2011 +0000 +++ b/libpurple/protocols/simple/simple.c Sun Jul 10 13:11:36 2011 +0000 @@ -1932,6 +1932,8 @@ gc->proto_data = sip = g_new0(struct simple_account_data, 1); sip->gc = gc; + sip->fd = -1; + sip->listenfd = -1; sip->account = account; sip->registerexpire = 900; sip->udp = purple_account_get_bool(account, "udp", FALSE);
--- a/libpurple/upnp.c Sat Jul 09 22:34:25 2011 +0000 +++ b/libpurple/upnp.c Sun Jul 10 13:11:36 2011 +0000 @@ -535,7 +535,7 @@ dd->retry_count++; purple_upnp_discover_send_broadcast(dd); } else { - if (dd->fd) + if (dd->fd != -1) close(dd->fd); control_info.status = PURPLE_UPNP_STATUS_UNABLE_TO_DISCOVER; @@ -662,7 +662,7 @@ } /* Set up the sockets */ - sock = socket(AF_INET, SOCK_DGRAM, 0); + dd->fd = sock = socket(AF_INET, SOCK_DGRAM, 0); if(sock == -1) { purple_debug_error("upnp", "purple_upnp_discover(): Failed In sock creation\n"); @@ -672,8 +672,6 @@ return; } - dd->fd = sock; - /* TODO: Non-blocking! */ if((hp = gethostbyname(HTTPMU_HOST_ADDRESS)) == NULL) { purple_debug_error("upnp", @@ -820,7 +818,7 @@ static void looked_up_internal_ip_cb(gpointer data, gint source, const gchar *error_message) { - if (source) { + if (source != -1) { strncpy(control_info.internalip, purple_network_get_local_system_ip(source), sizeof(control_info.internalip));