a56a5e
From ffecc452321bbef2c0e1efca09c2077775448141 Mon Sep 17 00:00:00 2001
90b079
From: Harald Hoyer <harald@redhat.com>
90b079
Date: Fri, 13 Sep 2013 16:33:01 +0200
90b079
Subject: [PATCH] dracut.sh: harden host_modalias reading
90b079
90b079
Some weird PPC driver make their modulias unreadable
90b079
90b079
$ cat /sys/devices/vio/4000/modalias
90b079
cat: /sys/devices/vio/4000/modalias: No such device
90b079
---
90b079
 dracut.sh | 2 +-
90b079
 1 file changed, 1 insertion(+), 1 deletion(-)
90b079
90b079
diff --git a/dracut.sh b/dracut.sh
1755ca
index bd905e32..fd278466 100755
90b079
--- a/dracut.sh
90b079
+++ b/dracut.sh
90b079
@@ -921,7 +921,7 @@ if [[ $hostonly ]]; then
90b079
     declare -A host_modalias
90b079
     find  /sys/devices/ -name modalias -print > "$initdir/.modalias"
90b079
     while read m; do
90b079
-        host_modalias["$(<"$m")"]=1
90b079
+        modalias="$(<"$m")" && [[ $modalias ]] && host_modalias["$modalias"]=1
90b079
     done < "$initdir/.modalias"
90b079
     rm -f -- "$initdir/.modalias"
90b079