From: Max Kellermann Date: Sun, 21 Sep 2008 20:42:52 +0000 (+0200) Subject: mpdclient: check errorCode only if MPD_ERROR_ACK is set X-Git-Tag: v0.12_alpha1~202 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a6df916494891d3dd7ab2262f1c74c6db4604c0c;p=ncmpc.git mpdclient: check errorCode only if MPD_ERROR_ACK is set connection->errorCode has an undefined value when connection->error is not MPD_ERROR_ACK. Read it only if MPD_ERROR_ACK is set, to make valgrind happy. --- diff --git a/src/mpdclient.c b/src/mpdclient.c index fcdaa4e..caa9fe3 100644 --- a/src/mpdclient.c +++ b/src/mpdclient.c @@ -126,7 +126,8 @@ mpdclient_finish_command(mpdclient_t *c) gint error = c->connection->error; gchar *msg; - if (c->connection->errorCode == MPD_ACK_ERROR_PERMISSION && + if (error == MPD_ERROR_ACK && + c->connection->errorCode == MPD_ACK_ERROR_PERMISSION && screen_auth(c) == 0) return 0;