# HG changeset patch # User Sadrul Habib Chowdhury # Date 1240854576 0 # Node ID 25e01fe7b732d34b81d7ece08b4c335290aa1f5c # Parent 882667b6794b817eab7f82a3afe0b76685b82660 Fix a couple of runtime-warnings when disconnecting a yahoo account. diff -r 882667b6794b -r 25e01fe7b732 libpurple/protocols/yahoo/yahoo.c --- a/libpurple/protocols/yahoo/yahoo.c Mon Apr 27 17:34:57 2009 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Mon Apr 27 17:49:36 2009 +0000 @@ -2705,13 +2705,20 @@ } /* remove timeout */ - purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); - yd->yahoo_p2p_server_timeout_handle = 0; + if (yd->yahoo_p2p_server_timeout_handle) { + purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); + yd->yahoo_p2p_server_timeout_handle = 0; + } /* remove watcher and close p2p server */ - purple_input_remove(yd->yahoo_p2p_server_watcher); - close(yd->yahoo_local_p2p_server_fd); - yd->yahoo_local_p2p_server_fd = -1; + if (yd->yahoo_p2p_server_watcher) { + purple_input_remove(yd->yahoo_p2p_server_watcher); + yd->yahoo_p2p_server_watcher = 0; + } + if (yd->yahoo_local_p2p_server_fd >= 0) { + close(yd->yahoo_local_p2p_server_fd); + yd->yahoo_local_p2p_server_fd = -1; + } /* Add an Input Read event to the file descriptor */ p2p_data->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data); @@ -3769,13 +3776,20 @@ yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */ purple_timeout_remove(yd->yahoo_p2p_timer); - if(yd->yahoo_p2p_server_timeout_handle != 0) + if(yd->yahoo_p2p_server_timeout_handle != 0) { purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); + yd->yahoo_p2p_server_timeout_handle = 0; + } /* close p2p server if it is waiting for a peer to connect */ - purple_input_remove(yd->yahoo_p2p_server_watcher); - close(yd->yahoo_local_p2p_server_fd); - yd->yahoo_local_p2p_server_fd = -1; + if (yd->yahoo_p2p_server_watcher) { + purple_input_remove(yd->yahoo_p2p_server_watcher); + yd->yahoo_p2p_server_watcher = 0; + } + if (yd->yahoo_local_p2p_server_fd >= 0) { + close(yd->yahoo_local_p2p_server_fd); + yd->yahoo_local_p2p_server_fd = -1; + } g_hash_table_destroy(yd->sms_carrier); g_hash_table_destroy(yd->peers);