1755ca
From 43d6b9d0085c393c7cdb0fd1f1181654d0f87e61 Mon Sep 17 00:00:00 2001
1755ca
From: Pingfan Liu <piliu@redhat.com>
1755ca
Date: Mon, 4 Dec 2017 17:24:11 +0800
1755ca
Subject: [PATCH] dracut.sh: for_each_host_xx() function should indicate the
1755ca
 empty case
1755ca
1755ca
The caller of "for_each_host_xx func" needs to tell three cases:
1755ca
func success/ fail / not be called.
1755ca
E.g, in kdump case, host_devs can be empty, and we want to know it.
1755ca
1755ca
Signed-off-by: Pingfan Liu <piliu@redhat.com>
1755ca
1755ca
Cherry-picked from: e6199960d9bbfe6d860a32716b7e9bac7e657a4f
1755ca
Resolves: #1520721
1755ca
---
1755ca
 dracut-functions.sh | 7 ++++---
1755ca
 1 file changed, 4 insertions(+), 3 deletions(-)
1755ca
1755ca
diff --git a/dracut-functions.sh b/dracut-functions.sh
1755ca
index 23768bdc..4051596b 100755
1755ca
--- a/dracut-functions.sh
1755ca
+++ b/dracut-functions.sh
1755ca
@@ -593,7 +593,8 @@ for_each_host_dev_fs()
1755ca
     local _dev
1755ca
     local _ret=1
1755ca
 
1755ca
-    [[ "${#host_fs_types[@]}" ]] || return 0
1755ca
+    [[ "${#host_fs_types[@]}" ]] || return 2
1755ca
+
1755ca
 
1755ca
     for _dev in "${!host_fs_types[@]}"; do
1755ca
         $_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
1755ca
@@ -652,7 +653,7 @@ for_each_host_dev_and_slaves_all()
1755ca
     local _dev
1755ca
     local _ret=1
1755ca
 
1755ca
-    [[ "${host_devs[@]}" ]] || return 0
1755ca
+    [[ "${host_devs[@]}" ]] || return 2
1755ca
 
1755ca
     for _dev in "${host_devs[@]}"; do
1755ca
         [[ -b "$_dev" ]] || continue
1755ca
@@ -668,7 +669,7 @@ for_each_host_dev_and_slaves()
1755ca
     local _func="$1"
1755ca
     local _dev
1755ca
 
1755ca
-    [[ "${host_devs[@]}" ]] || return 0
1755ca
+    [[ "${host_devs[@]}" ]] || return 2
1755ca
 
1755ca
     for _dev in "${host_devs[@]}"; do
1755ca
         [[ -b "$_dev" ]] || continue