Author: draenog
Date: Wed Jan 25 15:28:06 2012
New Revision: 12467

Modified:
   rc-scripts/trunk/lib/functions
Log:
- fix daemon --user --fork as they conflicted with each other


Modified: rc-scripts/trunk/lib/functions
==============================================================================
--- rc-scripts/trunk/lib/functions      (original)
+++ rc-scripts/trunk/lib/functions      Wed Jan 25 15:28:06 2012
@@ -573,12 +573,10 @@
                        ;;
                --user)
                        shift
-                       [ "$1" != "root" ] && prog="/bin/su $1 -s /bin/sh -c \""
                        user=$1
                        ;;
                --fork)
                        fork=1
-                       prog="/usr/bin/setsid sh -c \""
                        end='&'
                        ;;
                --chdir)
@@ -618,6 +616,12 @@
                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
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to