]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-program-client: Rename "exit_code" to "exit_status"
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 18 Feb 2021 10:33:06 +0000 (12:33 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 12 May 2021 10:32:10 +0000 (10:32 +0000)
exit_code typically refers to the numeric 0..255 value that processes exit
with.

src/lib-program-client/program-client-local.c
src/lib-program-client/program-client-private.h
src/lib-program-client/program-client-remote.c
src/lib-program-client/program-client.c
src/lib-program-client/program-client.h

index ed7e9f05d46feda78f459b852b98fcfeac6633f5..499b2b5e1aa4174c399794cd97ec776ea6327f24 100644 (file)
@@ -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;
        }
index 1c15d7d85c67e5d6806571740ef1e1d1b1e96bbe..5f6260a5469b16d9777ec6fb22e1ba0dd88340fa 100644 (file)
@@ -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);
index f49cde28082a0e8805858d57edd9d6796d502633..c29b19ebd1e08b709d5df2c5101f5d0567219879 100644 (file)
@@ -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;
        }
 }
 
index 07e391ffb5841fa5e7c5873bf99ee823d3b544cd..246eea6ef6e97601182cef5f3fc6884205a933f6 100644 (file)
@@ -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;
index 5beb534dac82ce64d0ab26cc893134c7ef08c0d2..2aaad3e0878104381f5ccefeea6edaf36489ca09 100644 (file)
@@ -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 {