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