]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
dracut.sh: for_each_host_xx() function should indicate the empty case 311/head
authorPingfan Liu <piliu@redhat.com>
Mon, 4 Dec 2017 09:24:11 +0000 (17:24 +0800)
committerHarald Hoyer <harald@redhat.com>
Mon, 4 Dec 2017 10:04:53 +0000 (11:04 +0100)
The caller of "for_each_host_xx func" needs to tell three cases:
func success/ fail / not be called.
E.g, in kdump case, host_devs can be empty, and we want to know it.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
dracut-functions.sh

index 112b2434cc08d1c71dd4de68f393a471e6ac4901..575bd4a69a1aac0a41042a1d19fe6d671ca341b5 100755 (executable)
@@ -468,7 +468,8 @@ for_each_host_dev_fs()
     local _dev
     local _ret=1
 
-    [[ "${#host_fs_types[@]}" ]] || return 0
+    [[ "${#host_fs_types[@]}" ]] || return 2
+
 
     for _dev in "${!host_fs_types[@]}"; do
         $_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
@@ -527,7 +528,7 @@ for_each_host_dev_and_slaves_all()
     local _dev
     local _ret=1
 
-    [[ "${host_devs[@]}" ]] || return 0
+    [[ "${host_devs[@]}" ]] || return 2
 
     for _dev in "${host_devs[@]}"; do
         [[ -b "$_dev" ]] || continue
@@ -543,7 +544,7 @@ for_each_host_dev_and_slaves()
     local _func="$1"
     local _dev
 
-    [[ "${host_devs[@]}" ]] || return 0
+    [[ "${host_devs[@]}" ]] || return 2
 
     for _dev in "${host_devs[@]}"; do
         [[ -b "$_dev" ]] || continue