diff options
-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 |