From mboxrd@z Thu Jan  1 00:00:00 1970
From: Jonatan Schlag <jonatan.schlag@ipfire.org>
To: network@lists.ipfire.org
Subject: [PATCH 3/3] hook: return error codes to previos functions
Date: Wed, 19 Jul 2017 16:10:22 +0200
Message-ID: <1500473422-24614-3-git-send-email-jonatan.schlag@ipfire.org>
In-Reply-To: <1500473422-24614-1-git-send-email-jonatan.schlag@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============5574574227941227652=="
List-Id: <network.lists.ipfire.org>

--===============5574574227941227652==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

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 funct=
ion.
So we candle handle errors better.

Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
---
 src/functions/functions.hook | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/functions/functions.hook b/src/functions/functions.hook
index b99023d..d1f6506 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
=20
--=20
2.6.3


--===============5574574227941227652==--