From be7d47d223dbb11c1cd7dc2faa3722d0b94c86b0 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Sun, 9 Feb 2025 16:05:13 +0100 Subject: [PATCH] package/mdnsd/S50mdnsd: do not clobber exit code As pointed out by shellcheck, the exit code of the start/stop/restart/reload command is clobbered by the 'echo "FAIL'" statement: In package/mdnsd/S50mdnsd line 52: exit $? ^-- SC2320 (warning): This $? refers to echo/printf, not a previous command. Assign to variable to avoid it being overwritten. So introduce a $status variable to keep track of it, similar to how it is done in S40iwd. Signed-off-by: Peter Korsgaard (cherry picked from commit be20c12e157c0e67875d8031de17df41a9c55679) Signed-off-by: Peter Korsgaard --- package/mdnsd/S50mdnsd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/mdnsd/S50mdnsd b/package/mdnsd/S50mdnsd index 1c2b71802c..6d77671396 100644 --- a/package/mdnsd/S50mdnsd +++ b/package/mdnsd/S50mdnsd @@ -36,7 +36,9 @@ reload() { case "$1" in start|stop|restart|reload) - if "$1"; then + "$1" + status=$? + if [ "$status" -eq 0 ]; then echo "OK" else echo "FAIL" @@ -48,4 +50,4 @@ case "$1" in ;; esac -exit $? +exit "$status"