[v2,5/5] fff-gateway: Use return for errors in config version check

Submitted by Adrian Schmutzler on April 26, 2020, 11:49 a.m.

Details

Message ID 20200426114953.1241-5-freifunk@adrianschmutzler.de
State Accepted
Headers show

Commit Message

Adrian Schmutzler April 26, 2020, 11:49 a.m.
The concept of configuregateway is to respond on the return codes
of the gateway.d files, and exit if anyone returns something different
than zero.

Thus, let's not exit in gateway.d files directly, but stick to that
logic and return 1.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
---
 src/packages/fff/fff-gateway/files/etc/gateway.d/01-version | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-gateway/files/etc/gateway.d/01-version b/src/packages/fff/fff-gateway/files/etc/gateway.d/01-version
index 41c3cf7f..8c96767d 100644
--- a/src/packages/fff/fff-gateway/files/etc/gateway.d/01-version
+++ b/src/packages/fff/fff-gateway/files/etc/gateway.d/01-version
@@ -3,7 +3,7 @@  configure() {
 	if ! uci -q show gateway > /dev/null; then
 		echo "ERROR: Gateway config could not be parsed or does not exist."
 
-		exit 1
+		return 1
 	fi
 
 	# check version of configuration
@@ -13,14 +13,14 @@  configure() {
 	if ! [ -n "$config_version" ]; then
 		echo "ERROR: No config version given. Supported versions: '$expected_version'"
 
-		exit 1
+		return 1
 	fi
 
 	if [ "$config_version" != "$expected_version" ]; then
 		echo "ERROR: Invalid config version. Expected '$expected_version', got '$config_version'."
 		echo "Please check what has been changed and adjust your config appropriately."
 
-		exit 1
+		return 1
 	fi
 
 	return 0