Blame 0004-dracut-logger-create-logfile-with-0600-permissions.patch

Harald Hoyer f3160a
From e45ffb5d1fddf751f50bc268846d81659120be62 Mon Sep 17 00:00:00 2001
Harald Hoyer f3160a
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer f3160a
Date: Wed, 20 Jul 2011 17:24:33 +0200
Harald Hoyer f3160a
Subject: [PATCH] dracut-logger: create logfile with 0600 permissions
Harald Hoyer f3160a
Harald Hoyer f3160a
---
Harald Hoyer f3160a
 dracut-logger |    4 ++++
Harald Hoyer f3160a
 1 files changed, 4 insertions(+), 0 deletions(-)
Harald Hoyer f3160a
Harald Hoyer f3160a
diff --git a/dracut-logger b/dracut-logger
Harald Hoyer f3160a
index 3bcce83..a5a3ee9 100755
Harald Hoyer f3160a
--- a/dracut-logger
Harald Hoyer f3160a
+++ b/dracut-logger
Harald Hoyer f3160a
@@ -106,6 +106,7 @@ __DRACUT_LOGGER__=1
Harald Hoyer f3160a
 # @warning Function sets global variables @var maxloglvl and @syslogfacility.
Harald Hoyer f3160a
 # See file doc comment for details.
Harald Hoyer f3160a
 dlog_init() {
Harald Hoyer f3160a
+    local __oldumask
Harald Hoyer f3160a
     # Skip initialization if it's already done.
Harald Hoyer f3160a
     [ -n "$maxloglvl" ] && return 0
Harald Hoyer f3160a
 
Harald Hoyer f3160a
@@ -118,7 +119,10 @@ dlog_init() {
Harald Hoyer f3160a
     if [ -z "$fileloglvl" ]; then
Harald Hoyer f3160a
         [ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
Harald Hoyer f3160a
     elif [ $fileloglvl -gt 0 ]; then
Harald Hoyer f3160a
+        __oldumask=$(umask)
Harald Hoyer f3160a
+        umask 0377
Harald Hoyer f3160a
         ! [ -e "$logfile" ] && >"$logfile"
Harald Hoyer f3160a
+        umask $__oldumask
Harald Hoyer f3160a
         if [ -w "$logfile" -a -f "$logfile" ]; then
Harald Hoyer f3160a
             # Mark new run in the log file
Harald Hoyer f3160a
             echo >>"$logfile"