]> git.ipfire.org Git - people/ms/network.git/commitdiff
hook: return error codes to previos functions
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Wed, 19 Jul 2017 14:10:22 +0000 (16:10 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 19 Jul 2017 17:10:14 +0000 (19:10 +0200)
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 <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.hook

index b99023d558b1427a00d4110fb49fc9e926939bbd..d1f6506835eb5ff74b687d9988d8d3bdf0076633 100644 (file)
@@ -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