SOURCES: syslog.init - fix logfile owners also when reloading afte...

glen glen at pld-linux.org
Tue Nov 1 16:10:37 CET 2005


Author: glen                         Date: Tue Nov  1 15:10:37 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fix logfile owners also when reloading after logrotate

---- Files affected:
SOURCES:
   syslog.init (1.23 -> 1.24) 

---- Diffs:

================================================================
Index: SOURCES/syslog.init
diff -u SOURCES/syslog.init:1.23 SOURCES/syslog.init:1.24
--- SOURCES/syslog.init:1.23	Fri Oct 28 11:09:25 2005
+++ SOURCES/syslog.init	Tue Nov  1 16:10:31 2005
@@ -46,12 +46,17 @@
 		OPTIONS="$OPTIONS -a $a"
 	done
 fi
-FIXFILES=""
+
 if [ -n "$RUNAS" ]; then
 	OPTIONS="$OPTIONS -u $RUNAS"
-	FIXFILES=$(/usr/sbin/syslogd-listfiles -f "$CONFIG_FILE" -a)
 fi
 
+chown_syslog_files() {
+	[ -z "$RUNAS" ] || return
+
+	chown ${RUNAS}: $(/usr/sbin/syslogd-listfiles -f "$CONFIG_FILE" -a)
+}
+
 RETVAL=0
 # See how we were called.
 case "$1" in
@@ -59,9 +64,7 @@
 	# Check if the service is already running?
 	if [ ! -f /var/lock/subsys/syslog ]; then
 		msg_starting "System logger"
-		if [ "$FIXFILES" ]; then
-			chown ${RUNAS}: $FIXFILES
-		fi
+		chown_syslog_files
 		daemon syslogd $OPTIONS
 		RETVAL=$?
 		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/syslog
@@ -85,6 +88,7 @@
   reload|force-reload)
 	if [ -f /var/lock/subsys/syslog ]; then
 		msg_reloading "System logger"
+		chown_syslog_files
 		killproc syslogd -HUP
 		RETVAL=$?
 	else
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/syslog.init?r1=1.23&r2=1.24&f=u




More information about the pld-cvs-commit mailing list