Code

screen_client: recover from UPDATE_ALREADY error
authorMax Kellermann <max@duempel.org>
Fri, 2 Oct 2009 07:35:23 +0000 (09:35 +0200)
committerMax Kellermann <max@duempel.org>
Fri, 2 Oct 2009 07:35:23 +0000 (09:35 +0200)
If mpd_connection_clear_error() fails, revert to
mpdclient_handle_error().

src/screen_client.c

index 9d60ed2cd6943cbd018653fdcc0bc4338d53ffc9..9e13ba00e3ebf9a092f8062aa7d2695c9390d2c9 100644 (file)
@@ -78,10 +78,10 @@ screen_database_update(struct mpdclient *c, const char *path)
        id = mpd_run_update(c->connection, path);
        if (id == 0) {
                if (mpd_connection_get_error(c->connection) == MPD_ERROR_SERVER &&
-                   mpd_connection_get_server_error(c->connection) == MPD_SERVER_ERROR_UPDATE_ALREADY) {
+                   mpd_connection_get_server_error(c->connection) == MPD_SERVER_ERROR_UPDATE_ALREADY &&
+                   mpd_connection_clear_error(c->connection))
                        screen_status_printf(_("Database update running..."));
-                       mpd_connection_clear_error(c->connection);
-               } else
+               else
                        mpdclient_handle_error(c);
                return;
        }