Blob Blame History Raw
From e5f6899a550d749f25a19043b6842609e327cceb Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 7 May 2014 13:33:14 +0200
Subject: [PATCH] dracut-lib.sh: fixed return value of pidof()

pidof always returned with 0, so any "while pidof" loop would not
terminate.

Thanks "Consus" for the hint!

(cherry picked from commit 4e58a1ffc760e5c54e6cae5924a2439cae196848)
---
 modules.d/99base/dracut-lib.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 62facda1..66977e73 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -962,6 +962,7 @@ if ! command -v pidof >/dev/null 2>/dev/null; then
         local _cmd
         local _exe
         local _rl
+        local _ret=1
         local i
         _cmd="$1"
         [ -z "$_cmd" ] && return 1
@@ -976,8 +977,9 @@ if ! command -v pidof >/dev/null 2>/dev/null; then
             fi
             i=${i%/exe}
             echo ${i##/proc/}
+            _ret=0
         done
-        return 0
+        return $_ret
     }
 fi