From 4f552ec230a1a4241b664e84be0c654f3b563651 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 29 Sep 2009 23:18:02 +0200 Subject: [PATCH] mpdclient: handle password errors properly in mpdclient_connect() Abort the connection when the configured password fails. --- src/mpdclient.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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; -- 2.30.2