File 0146-dracut.sh-corrected-logfile-check.patch of Package dracut.376

From 077c4bc889733c6c38b767c99f56ef67a82ef432 Mon Sep 17 00:00:00 2001
From: jloeser <jloeser@suse.de>
Date: Fri, 22 Aug 2014 16:31:34 +0200
Subject: dracut.sh: corrected logfile check

---
 dracut.sh |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/dracut.sh b/dracut.sh
index ffe4989..5bf41f2 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -803,9 +803,13 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
 # eliminate IFS hackery when messing with fw_dir
 fw_dir=${fw_dir//:/ }
 
-if [[ ! -f $logfile ]];then
-    if [[ ! `touch $logfile > /dev/null 2>&1` ]];then
-        printf "%s\n" "dracut: touch $logfile failed. Couldn't create logfile."
+# check for logfile and try to create one if it doesn't exist
+if [[ -n "$logfile" ]];then
+    if [[ ! -f "$logfile" ]];then
+        touch "$logfile"
+        if [ ! $? -eq 0 ] ;then
+            printf "%s\n" "dracut: touch $logfile failed." >&2
+        fi
     fi
 fi
 
-- 
1.7.6.1

openSUSE Build Service is sponsored by