Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Sep 2023 13:19:55 GMT
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: f701d9da1d94 - stable/14 - rc.subr: don't require service to be enabled for `status`
Message-ID:  <202309241319.38ODJtol079698@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=f701d9da1d94891dd2edad607a989cad6eb10313

commit f701d9da1d94891dd2edad607a989cad6eb10313
Author:     Daniel Tameling <tamelingdaniel@gmail.com>
AuthorDate: 2023-07-01 08:43:40 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-09-24 13:17:43 +0000

    rc.subr: don't require service to be enabled for `status`
    
    For a service that sets an rcvar, there is a check whether it has been
    enabled before the actual command is executed. If the check fails, one
    gets a message to enable it and the returned exit status is 0.
    However, this is usually undesirable for the status command, which is
    a) supposed to check whether the service is running anyway and
    b) returns a non-zero exit code if that is not the case.
    Thus, skip the check for the status command.
    
    PR:             272282
    Reviewed by:    emaste
    
    (cherry picked from commit ba793728a840041e93e38bcbff4a7233dc63b722)
---
 libexec/rc/rc.subr | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
index 17ca904ff1e7..332718dc6f2c 100644
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -1041,13 +1041,14 @@ run_rc_command()
 			continue
 		fi
 					# if ${rcvar} is set, $1 is not "rcvar", "describe",
-					# "enable" or "delete", and ${rc_pid} is not set, run:
+					# "enable", "delete" or "status", and ${rc_pid} is
+					# not set, run:
 					#	checkyesno ${rcvar}
 					# and return if that failed
 					#
 		if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a "$rc_arg" != "stop" \
 		    -a "$rc_arg" != "delete" -a "$rc_arg" != "enable" \
-		    -a "$rc_arg" != "describe" ] ||
+		    -a "$rc_arg" != "describe" -a "$rc_arg" != "status" ] ||
 		    [ -n "${rcvar}" -a "$rc_arg" = "stop" -a -z "${rc_pid}" ]; then
 			if ! checkyesno ${rcvar}; then
 				if [ -n "${rc_quiet}" ]; then



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309241319.38ODJtol079698>