Blame SOURCES/0521-dracut.sh-for_each_host_xx-function-should-indicate-.patch

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