a56a5e
From e5f6899a550d749f25a19043b6842609e327cceb Mon Sep 17 00:00:00 2001
a56a5e
From: Harald Hoyer <harald@redhat.com>
a56a5e
Date: Wed, 7 May 2014 13:33:14 +0200
a56a5e
Subject: [PATCH] dracut-lib.sh: fixed return value of pidof()
a56a5e
a56a5e
pidof always returned with 0, so any "while pidof" loop would not
a56a5e
terminate.
a56a5e
a56a5e
Thanks "Consus" for the hint!
a56a5e
a56a5e
(cherry picked from commit 4e58a1ffc760e5c54e6cae5924a2439cae196848)
a56a5e
---
a56a5e
 modules.d/99base/dracut-lib.sh | 4 +++-
a56a5e
 1 file changed, 3 insertions(+), 1 deletion(-)
a56a5e
a56a5e
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
1755ca
index 62facda1..66977e73 100755
a56a5e
--- a/modules.d/99base/dracut-lib.sh
a56a5e
+++ b/modules.d/99base/dracut-lib.sh
a56a5e
@@ -962,6 +962,7 @@ if ! command -v pidof >/dev/null 2>/dev/null; then
a56a5e
         local _cmd
a56a5e
         local _exe
a56a5e
         local _rl
a56a5e
+        local _ret=1
a56a5e
         local i
a56a5e
         _cmd="$1"
a56a5e
         [ -z "$_cmd" ] && return 1
a56a5e
@@ -976,8 +977,9 @@ if ! command -v pidof >/dev/null 2>/dev/null; then
a56a5e
             fi
a56a5e
             i=${i%/exe}
a56a5e
             echo ${i##/proc/}
a56a5e
+            _ret=0
a56a5e
         done
a56a5e
-        return 0
a56a5e
+        return $_ret
a56a5e
     }
a56a5e
 fi
a56a5e