From: Max Kellermann Date: Tue, 29 Sep 2009 21:18:02 +0000 (+0200) Subject: mpdclient: handle password errors properly in mpdclient_connect() X-Git-Tag: release-0.16~290 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4f552ec230a1a4241b664e84be0c654f3b563651;p=ncmpc.git mpdclient: handle password errors properly in mpdclient_connect() Abort the connection when the configured password fails. --- diff --git a/src/mpdclient.c b/src/mpdclient.c index 5e138ed..77638d6 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -186,8 +186,6 @@ mpdclient_connect(struct mpdclient *c, gfloat _timeout, const gchar *password) { - gint retval = 0; - /* close any open connection */ if( c->connection ) mpdclient_disconnect(c); @@ -204,9 +202,10 @@ mpdclient_connect(struct mpdclient *c, } /* send password */ - if( password ) { - mpd_send_password(c->connection, password); - retval = mpdclient_finish_command(c); + if (password != NULL && !mpd_run_password(c->connection, password)) { + mpdclient_handle_error(c); + mpdclient_disconnect(c); + return false; } return true;