diff options
author | Daniil Baturin <daniil@baturin.org> | 2020-02-11 16:17:02 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2020-02-11 16:17:02 +0100 |
commit | 4592ae65d42e5d8eba77350f8339e07350ad0908 (patch) | |
tree | ffb64d49ef778ef4537ab8a320f422276b3a9089 | |
parent | 72d0243f10e4df7c2fb7ce35c3d7f333e83bab97 (diff) | |
download | vyatta-cfg-4592ae65d42e5d8eba77350f8339e07350ad0908.tar.gz vyatta-cfg-4592ae65d42e5d8eba77350f8339e07350ad0908.zip |
T2026: use unique exit codes for commit errors.
-rw-r--r-- | src/commit2.cpp | 14 | ||||
-rw-r--r-- | src/vyos-errors.h | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/commit2.cpp b/src/commit2.cpp index 4594d08..aaccb08 100644 --- a/src/commit2.cpp +++ b/src/commit2.cpp @@ -8,6 +8,7 @@ #include <glib-object.h> /* g_type_init */ #include "common/common.h" #include "cli_path_utils.h" +#include "vyos-errors.h" #define cond_plog(cond, prio, fmt, ...) do { \ if (cond) { \ @@ -408,7 +409,18 @@ main(int argc, char** argv) //remove tmp changes file as all the work is now done unlink(COMMIT_CHANGES_FILE); - exit (errors == 2 ? 0 : 1); + int vyos_exit_code; + if (errors == 2) { + vyos_exit_code = 0; + } + else if (errors == 3) { + vyos_exit_code = VYOS_PARTIAL_COMMIT; + } + else { + vyos_exit_code = VYOS_COMMIT_FAILURE; + } + + exit (vyos_exit_code); } struct ExecuteHookData diff --git a/src/vyos-errors.h b/src/vyos-errors.h index 4ac9f57..b607659 100644 --- a/src/vyos-errors.h +++ b/src/vyos-errors.h @@ -3,3 +3,5 @@ #define VYOS_INVALID_PATH 2 #define VYOS_EMPTY_CONFIG 3 #define VYOS_CONFIG_PARSE_ERROR 4 +#define VYOS_COMMIT_FAILURE 5 +#define VYOS_PARTIAL_COMMIT 6 |