Blob Blame History Raw
From 57f90974f9d7c11e06c2b3f2b7e4b47801f380cc Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 13 Sep 2013 16:33:01 +0200
Subject: [PATCH] dracut.sh: harden host_modalias reading

Some weird PPC driver make their modulias unreadable

$ cat /sys/devices/vio/4000/modalias
cat: /sys/devices/vio/4000/modalias: No such device
---
 dracut.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dracut.sh b/dracut.sh
index bd905e3..fd27846 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -921,7 +921,7 @@ if [[ $hostonly ]]; then
     declare -A host_modalias
     find  /sys/devices/ -name modalias -print > "$initdir/.modalias"
     while read m; do
-        host_modalias["$(<"$m")"]=1
+        modalias="$(<"$m")" && [[ $modalias ]] && host_modalias["$modalias"]=1
     done < "$initdir/.modalias"
     rm -f -- "$initdir/.modalias"