From: Elan Ruusamäe Date: Thu, 8 Oct 2015 14:37:29 +0000 (+0300) Subject: daemon: move $prog build to RC_LOGGING=yes part, ssd does not use it X-Git-Tag: 0.4.15~7 X-Git-Url: https://git.pld-linux.org/?p=projects%2Frc-scripts.git;a=commitdiff_plain;h=04a486e0827d935351288c255d03dc71aeb7c727 daemon: move $prog build to RC_LOGGING=yes part, ssd does not use it --- diff --git a/lib/functions b/lib/functions index bbdbd64c..8a6d9c98 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