From 4592ae65d42e5d8eba77350f8339e07350ad0908 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 11 Feb 2020 16:17:02 +0100 Subject: T2026: use unique exit codes for commit errors. --- src/commit2.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/commit2.cpp') 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 /* 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 -- cgit v1.2.3