]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(dracut-logger.sh): this fixes the dlog_init check for /dev/log
authorBrian C. Lane <bcl@redhat.com>
Tue, 1 Nov 2022 17:06:20 +0000 (10:06 -0700)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Thu, 3 Nov 2022 03:49:47 +0000 (23:49 -0400)
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.

dracut-logger.sh

index 07389285e81a33ce5a83f6cd461193fd97cb5c5e..0dd17cc666a3ba2abab67e75611cea9a5fbf94f6 100755 (executable)
@@ -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