[projects/rc-scripts] daemon: move $prog build to RC_LOGGING=yes part, ssd does not use it

glen glen at pld-linux.org
Sat Oct 10 01:32:36 CEST 2015


commit 04a486e0827d935351288c255d03dc71aeb7c727
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Thu Oct 8 17:37:29 2015 +0300

    daemon: move $prog build to RC_LOGGING=yes part, ssd does not use it

 lib/functions | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/lib/functions b/lib/functions
index bbdbd64..8a6d9c9 100644
--- a/lib/functions
+++ b/lib/functions
@@ -698,19 +698,6 @@ daemon() {
 		esac
 		shift
 	done
-	if [ -n "$user" -a "$user" != "root" ]; then
-		prog="/bin/su $user -s /bin/sh -c \""
-	fi
-	if [ "$fork" = "1" ]; then
-		prog="/usr/bin/setsid ${prog:-sh -c \"}"
-	fi
-	# If command to execute ends with quotation mark, add remaining
-	# arguments and close quotation.
-	if [ "$prog" != "${prog%\"}" ]; then
-		prog="$prog $*$end\""
-	else
-		prog="$prog $*$end"
-	fi
 
 	_daemon_set_ulimits
 
@@ -778,6 +765,20 @@ daemon() {
 				--exec "$prog" \
 				-- "$@"
 		else
+			if [ -n "$user" -a "$user" != "root" ]; then
+				prog="/bin/su $user -s /bin/sh -c \""
+			fi
+			if [ "$fork" = "1" ]; then
+				prog="/usr/bin/setsid ${prog:-sh -c \"}"
+			fi
+			# If command to execute ends with quotation mark, add remaining
+			# arguments and close quotation.
+			if [ "$prog" != "${prog%\"}" ]; then
+				prog="$prog $*$end\""
+			else
+				prog="$prog $*$end"
+			fi
+
 			nice -n $nice initlog -c "$prog" 2>&1 </dev/null
 		fi
 		); then
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/rc-scripts.git/commitdiff/1a0c02d0983a76562fa875a1bab45ece246b26a6



More information about the pld-cvs-commit mailing list