diff --git a/lib/pacemaker/pcmk_status.c b/lib/pacemaker/pcmk_status.c index 80215d368e7..534ac2093f5 100644 --- a/lib/pacemaker/pcmk_status.c +++ b/lib/pacemaker/pcmk_status.c @@ -122,15 +122,20 @@ pacemakerd_status(pcmk__output_t *out) rc = pcmk_pacemakerd_api_ping(pacemakerd_api, crm_system_name); if (rc != pcmk_rc_ok) { - /* Got some error from pcmk_pacemakerd_api_ping, so return it. */ - } else if (state == pcmk_pacemakerd_state_running) { - rc = pcmk_rc_ok; - } else if (state == pcmk_pacemakerd_state_shutting_down) { - rc = ENOTCONN; - } else { - rc = EAGAIN; + // Got some error from pcmk_pacemakerd_api_ping, so return it + pcmk_free_ipc_api(pacemakerd_api); + return rc; } + switch (state) { + case pcmk_pacemakerd_state_running: + case pcmk_pacemakerd_state_shutting_down: + // CIB may still be accessible while shutting down + break; + default: + rc = ENOTCONN; + break; + } pcmk_free_ipc_api(pacemakerd_api); return rc; }