dracut/backport-fix-dracut-logger.sh-this-fixes-the-dlog_init-check-for-dev-log.patch
hongjinghao 9d9fb131b3 backport patchs from upstream
(cherry picked from commit 74c55dc789a3aacb444c42ab40cd308bd213f5e3)
2024-02-22 16:48:54 +08:00

34 lines
1.3 KiB
Diff

From 6b592f581c1a5ec489acee95779867e0485770fd Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 1 Nov 2022 10:06:20 -0700
Subject: [PATCH] fix(dracut-logger.sh): this fixes the dlog_init check for
/dev/log
The /dev/log check was not correct, it would continue working if
/dev/log was a broken symlink. This changes the logic to be more clear
-- /dev/log needs to be a socket, and writable, and logger needs to be
available. If any of those conditions fail, turn off syslog and only use
console logging.
Reference:https://github.com/dracutdevs/dracut/commit/6b592f581c1a5ec489acee95779867e0485770fd
Conflict:NA
---
dracut-logger.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-logger.sh b/dracut-logger.sh
index 07389285..0dd17cc6 100755
--- a/dracut-logger.sh
+++ b/dracut-logger.sh
@@ -151,7 +151,7 @@ dlog_init() {
readonly _dlogfd=15
systemd-cat -t 'dracut' --level-prefix=true < "$_systemdcatfile" &
exec 15> "$_systemdcatfile"
- elif ! [[ -S /dev/log ]] && [[ -w /dev/log ]] || ! command -v logger > /dev/null; then
+ elif ! ([[ -S /dev/log ]] && [[ -w /dev/log ]] && command -v logger > /dev/null); then
# We cannot log to syslog, so turn this facility off.
kmsgloglvl=$sysloglvl
sysloglvl=0
--
2.23.0