From: Jonatan Schlag Date: Wed, 19 Jul 2017 14:10:22 +0000 (+0200) Subject: hook: return error codes to previos functions X-Git-Tag: 009~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31cd8db9d357c0492b947fad42a0c6b8ff70832f;p=network.git hook: return error codes to previos functions When we call an hook we should not exit with the error code. Instead we should return the code to the function that called that hook function. So we candle handle errors better. Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.hook b/src/functions/functions.hook index b99023d5..d1f65068 100644 --- a/src/functions/functions.hook +++ b/src/functions/functions.hook @@ -102,11 +102,11 @@ hook_exec() { ${EXIT_COMMAND_NOT_FOUND}|${EXIT_NOT_SUPPORTED}) log ERROR "Hook '${hook}' does not implement the method '${cmd}':" log ERROR " arguments: $@" - exit ${EXIT_COMMAND_NOT_FOUND} + return ${EXIT_COMMAND_NOT_FOUND} ;; ${EXIT_ERROR_ASSERT}) log ERROR "Hook exited with an assertion error." - exit ${EXIT_ERROR_ASSERT} + return ${EXIT_ERROR_ASSERT} ;; esac