From f6c1fd34cab9318eac20db407b093a1cc0c300cc Mon Sep 17 00:00:00 2001 From: Michael Santos Date: Fri, 10 Mar 2023 07:21:00 -0500 Subject: [PATCH] 0.14.7: strophe 0.12: fix exit 1 on disconnect With strophe 0.12, xmppipe printed an error "handle_connection: disconnected" and exited with status 1 when the connection to the server is closed. --- src/xmppipe.c | 11 +++++++++-- src/xmppipe.h | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/xmppipe.c b/src/xmppipe.c index ced11e9..9fc8620 100644 --- a/src/xmppipe.c +++ b/src/xmppipe.c @@ -439,17 +439,24 @@ void handle_connection(xmpp_conn_t *const conn, const xmpp_conn_event_t status, xmppipe_state_t *state = userdata; switch (status) { +#ifdef XMPP_CONN_RAW_CONNECT + case XMPP_CONN_RAW_CONNECT: +#endif case XMPP_CONN_CONNECT: if (state->verbose) fprintf(stderr, "DEBUG: connected\n"); xmppipe_next_state(state, XMPPIPE_S_CONNECTED); break; - default: + case XMPP_CONN_DISCONNECT: xmppipe_next_state(state, XMPPIPE_S_DISCONNECTED); if (state->verbose) fprintf(stderr, "DEBUG: disconnected\n"); - errx(EXIT_FAILURE, "handle_connection: disconnected"); + break; + + default: + xmppipe_next_state(state, XMPPIPE_S_DISCONNECTED); + errx(EXIT_FAILURE, "handle_connection: disconnected (%d)", status); } } diff --git a/src/xmppipe.h b/src/xmppipe.h index ff9595e..0cad4fc 100644 --- a/src/xmppipe.h +++ b/src/xmppipe.h @@ -27,7 +27,7 @@ #include "strtonum.h" #endif -#define XMPPIPE_VERSION "0.14.6" +#define XMPPIPE_VERSION "0.14.7" #define XMPPIPE_RESOURCE "xmppipe" #define XMPPIPE_STREQ(a, b) (strcmp((a), (b)) == 0)