# HG changeset patch # User Mark Doliner # Date 1153715262 0 # Node ID 8a8b4f7f7d9910512a9638303481e9c5a667f185 # Parent a7b1d2ab9cb08b08cc26c67d2e43387e5670b7cb [gaim-migrate @ 16556] Fix a minor case of accessing something that had been free'd in oscar, and some other minor cleanup. FYI "0" is a valid file descriptor, but it will pretty much always be STDOUT, STDERR or STDIN. But I like to check for -1 anyway, because I'm weird. committer: Tailor Script diff -r a7b1d2ab9cb0 -r 8a8b4f7f7d99 src/protocols/oscar/flap_connection.c --- a/src/protocols/oscar/flap_connection.c Mon Jul 24 01:03:07 2006 +0000 +++ b/src/protocols/oscar/flap_connection.c Mon Jul 24 04:27:42 2006 +0000 @@ -205,7 +205,6 @@ flap_connection_destroy_rates(conn->rates); od->oscar_connections = g_list_remove(od->oscar_connections, conn); - g_free(conn); account = gaim_connection_get_account(od->gc); @@ -227,12 +226,18 @@ else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) tmp = _("Could not establish a connection with the server."); else + /* + * We shouldn't print a message for some disconnect_reasons. + * Like OSCAR_DISCONNECT_LOCAL_CLOSED. + */ tmp = NULL; if (tmp != NULL) gaim_connection_error(od->gc, tmp); } + g_free(conn); + return FALSE; } diff -r a7b1d2ab9cb0 -r 8a8b4f7f7d99 src/protocols/oscar/odc.c --- a/src/protocols/oscar/odc.c Mon Jul 24 01:03:07 2006 +0000 +++ b/src/protocols/oscar/odc.c Mon Jul 24 04:27:42 2006 +0000 @@ -37,25 +37,15 @@ const gchar *tmp; if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_CLOSED) - { tmp = _("The remote user has closed the connection."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_REMOTE_REFUSED) - { tmp = _("The remote user has declined your request."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_LOST_CONNECTION) - { tmp = _("Lost connection with the remote user for an unknown reason."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_INVALID_DATA) - { tmp = _("Received invalid data on connection with remote user."); - } else if (conn->disconnect_reason == OSCAR_DISCONNECT_COULD_NOT_CONNECT) - { tmp = _("Could not establish a connection with the remote user."); - } else /* * We shouldn't print a message for some disconnect_reasons. diff -r a7b1d2ab9cb0 -r 8a8b4f7f7d99 src/protocols/oscar/oscar.h --- a/src/protocols/oscar/oscar.h Mon Jul 24 01:03:07 2006 +0000 +++ b/src/protocols/oscar/oscar.h Mon Jul 24 04:27:42 2006 +0000 @@ -287,14 +287,14 @@ typedef enum { - OSCAR_DISCONNECT_DONE, - OSCAR_DISCONNECT_LOCAL_CLOSED, + OSCAR_DISCONNECT_DONE, /* not considered an error */ + OSCAR_DISCONNECT_LOCAL_CLOSED, /* peer connections only, not considered an error */ OSCAR_DISCONNECT_REMOTE_CLOSED, - OSCAR_DISCONNECT_REMOTE_REFUSED, + OSCAR_DISCONNECT_REMOTE_REFUSED, /* peer connections only */ OSCAR_DISCONNECT_LOST_CONNECTION, OSCAR_DISCONNECT_INVALID_DATA, OSCAR_DISCONNECT_COULD_NOT_CONNECT, - OSCAR_DISCONNECT_RETRYING + OSCAR_DISCONNECT_RETRYING /* peer connections only */ } OscarDisconnectReason; typedef enum diff -r a7b1d2ab9cb0 -r 8a8b4f7f7d99 src/sslconn.c --- a/src/sslconn.c Mon Jul 24 01:03:07 2006 +0000 +++ b/src/sslconn.c Mon Jul 24 04:27:42 2006 +0000 @@ -137,7 +137,7 @@ GaimSslConnection *gsc; GaimSslOps *ops; - g_return_val_if_fail(fd > 0, NULL); + g_return_val_if_fail(fd != -1, NULL); g_return_val_if_fail(func != NULL, NULL); g_return_val_if_fail(gaim_ssl_is_supported(), NULL); @@ -178,12 +178,10 @@ if (ops != NULL && ops->close != NULL) (ops->close)(gsc); - if (gsc->fd) + if (gsc->fd != -1) close(gsc->fd); - if (gsc->host != NULL) - g_free(gsc->host); - + g_free(gsc->host); g_free(gsc); }