git: f8f5b658bc76 - main - rc.subr:rc_trace take advantage of sdot
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 10 Feb 2025 22:26:51 UTC
The branch main has been updated by sjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=f8f5b658bc76cd539951fb8ac712d9acf71763ca
commit f8f5b658bc76cd539951fb8ac712d9acf71763ca
Author: Simon J. Gerraty <sjg@FreeBSD.org>
AuthorDate: 2025-02-10 22:23:38 +0000
Commit: Simon J. Gerraty <sjg@FreeBSD.org>
CommitDate: 2025-02-10 22:23:38 +0000
rc.subr:rc_trace take advantage of sdot
Since we now have sdot, use it to get RC_LEVEL from rc.conf.d/rc_trace
also avoid logging execution of ':' when RC_LEVEL > 0
Reviewed by: stevek
Differential Revision: https://reviews.freebsd.org/D48856
---
libexec/rc/rc.subr | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
index dc2cc06bb806..b7f8953012d7 100644
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -207,15 +207,8 @@ rc_trace()
if [ -z "$RC_LEVEL" ]; then
[ -f $cf ] || return
- if [ -s $cf ]; then
- # don't try to set RC_LEVEL without sed
- if [ -n "$SED" ]; then
- RC_LEVEL=$($SED -n '/^RC_LEVEL=/ { s/.*=//p;q; }' $cf)
- RC_LEVEL=${RC_LEVEL:-0}
- fi
- else
- RC_LEVEL=0
- fi
+ RC_LEVEL=0 # existence is 0 at least
+ sdot $cf # allow override
fi
[ ${RC_LEVEL:-0} -ge ${level:-0} ] || return
rc_log "$@"
@@ -1310,7 +1303,9 @@ run_rc_command()
_postcmd=\$${rc_arg}_postcmd
if [ -n "$_cmd" ]; then
- rc_trace 1 "$_cmd"
+ if [ "$_cmd" != : ]; then
+ rc_trace 1 "$_cmd"
+ fi
if [ -n "$_env" ]; then
eval "export -- $_env"
fi