From: Timo Sirainen Date: Thu, 18 Feb 2021 10:33:06 +0000 (+0200) Subject: lib-program-client: Rename "exit_code" to "exit_status" X-Git-Tag: 2.3.16~148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da5c1d11b901bf0ce36ff4eb30fb258fb9638bdb;p=thirdparty%2Fdovecot%2Fcore.git lib-program-client: Rename "exit_code" to "exit_status" exit_code typically refers to the numeric 0..255 value that processes exit with. --- diff --git a/src/lib-program-client/program-client-local.c b/src/lib-program-client/program-client-local.c index ed7e9f05d4..499b2b5e1a 100644 --- a/src/lib-program-client/program-client-local.c +++ b/src/lib-program-client/program-client-local.c @@ -334,7 +334,7 @@ program_client_local_exited(struct program_client_local *plclient) plclient->exited = TRUE; plclient->pid = -1; /* Evaluate child exit status */ - pclient->exit_code = PROGRAM_CLIENT_EXIT_INTERNAL_FAILURE; + pclient->exit_status = PROGRAM_CLIENT_EXIT_STATUS_INTERNAL_FAILURE; if (WIFEXITED(plclient->status)) { /* Exited */ @@ -344,9 +344,11 @@ program_client_local_exited(struct program_client_local *plclient) e_info(pclient->event, "Terminated with non-zero exit code %d", exit_code); - pclient->exit_code = PROGRAM_CLIENT_EXIT_FAILURE; + pclient->exit_status = + PROGRAM_CLIENT_EXIT_STATUS_FAILURE; } else { - pclient->exit_code = PROGRAM_CLIENT_EXIT_SUCCESS; + pclient->exit_status = + PROGRAM_CLIENT_EXIT_STATUS_SUCCESS; } } else if (WIFSIGNALED(plclient->status)) { /* Killed with a signal */ @@ -465,7 +467,7 @@ program_client_local_disconnect(struct program_client *pclient, bool force) if (pid < 0) { /* program never started */ e_debug(pclient->event, "Child process never started"); - pclient->exit_code = PROGRAM_CLIENT_EXIT_FAILURE; + pclient->exit_status = PROGRAM_CLIENT_EXIT_STATUS_FAILURE; program_client_local_exited(plclient); return; } diff --git a/src/lib-program-client/program-client-private.h b/src/lib-program-client/program-client-private.h index 1c15d7d85c..5f6260a546 100644 --- a/src/lib-program-client/program-client-private.h +++ b/src/lib-program-client/program-client-private.h @@ -48,7 +48,7 @@ struct program_client { bool other_error; enum program_client_error error; - enum program_client_exit_code exit_code; + enum program_client_exit_status exit_status; int (*connect) (struct program_client * pclient); int (*close_output) (struct program_client * pclient); diff --git a/src/lib-program-client/program-client-remote.c b/src/lib-program-client/program-client-remote.c index f49cde2808..c29b19ebd1 100644 --- a/src/lib-program-client/program-client-remote.c +++ b/src/lib-program-client/program-client-remote.c @@ -69,8 +69,8 @@ program_client_istream_parse_result(struct program_client_istream *scstream, e_error(scstream->client->event, "Missing LF in result code"); } - scstream->client->exit_code = - PROGRAM_CLIENT_EXIT_INTERNAL_FAILURE; + scstream->client->exit_status = + PROGRAM_CLIENT_EXIT_STATUS_INTERNAL_FAILURE; return; } @@ -79,12 +79,14 @@ program_client_istream_parse_result(struct program_client_istream *scstream, case '+': e_debug(scstream->client->event, "Received '+' result code from remote"); - scstream->client->exit_code = PROGRAM_CLIENT_EXIT_SUCCESS; + scstream->client->exit_status = + PROGRAM_CLIENT_EXIT_STATUS_SUCCESS; break; case '-': e_debug(scstream->client->event, "Received '-' result code from remote"); - scstream->client->exit_code = PROGRAM_CLIENT_EXIT_FAILURE; + scstream->client->exit_status = + PROGRAM_CLIENT_EXIT_STATUS_FAILURE; break; default: if (rcode >= 0x20 && rcode < 0x7f) { @@ -94,8 +96,8 @@ program_client_istream_parse_result(struct program_client_istream *scstream, e_error(scstream->client->event, "Unexpected result code 0x%02x", rcode); } - scstream->client->exit_code = - PROGRAM_CLIENT_EXIT_INTERNAL_FAILURE; + scstream->client->exit_status = + PROGRAM_CLIENT_EXIT_STATUS_INTERNAL_FAILURE; } } diff --git a/src/lib-program-client/program-client.c b/src/lib-program-client/program-client.c index 07e391ffb5..246eea6ef6 100644 --- a/src/lib-program-client/program-client.c +++ b/src/lib-program-client/program-client.c @@ -141,7 +141,7 @@ void program_client_disconnected(struct program_client *pclient) program_client_callback(pclient, (pclient->error != PROGRAM_CLIENT_ERROR_NONE ? - -1 : (int)pclient->exit_code), + -1 : (int)pclient->exit_status), pclient->context); } @@ -723,7 +723,7 @@ int program_client_run(struct program_client *pclient) if (pclient->error != PROGRAM_CLIENT_ERROR_NONE) return -1; - return (int)pclient->exit_code; + return (int)pclient->exit_status; } #undef program_client_run_async @@ -734,7 +734,7 @@ void program_client_run_async(struct program_client *pclient, i_assert(callback != NULL); pclient->disconnected = FALSE; - pclient->exit_code = PROGRAM_CLIENT_EXIT_SUCCESS; + pclient->exit_status = PROGRAM_CLIENT_EXIT_STATUS_SUCCESS; pclient->error = PROGRAM_CLIENT_ERROR_NONE; pclient->callback = callback; diff --git a/src/lib-program-client/program-client.h b/src/lib-program-client/program-client.h index 5beb534dac..2aaad3e087 100644 --- a/src/lib-program-client/program-client.h +++ b/src/lib-program-client/program-client.h @@ -6,10 +6,10 @@ struct program_client; -enum program_client_exit_code { - PROGRAM_CLIENT_EXIT_INTERNAL_FAILURE = -1, - PROGRAM_CLIENT_EXIT_FAILURE = 0, - PROGRAM_CLIENT_EXIT_SUCCESS = 1, +enum program_client_exit_status { + PROGRAM_CLIENT_EXIT_STATUS_INTERNAL_FAILURE = -1, + PROGRAM_CLIENT_EXIT_STATUS_FAILURE = 0, + PROGRAM_CLIENT_EXIT_STATUS_SUCCESS = 1, }; struct program_client_settings {