Allow for setting negative priority (niceness) when $foo_user is non-root.

The order in _doit must be "nice su", not "su nice", for that.
In addition, don't ignore the exit status from "cd $foo_chdir".

Reviewed by:	freebsd-rc (silence)
MFC after:	1 week
This commit is contained in:
Yaroslav Tykhiy 2006-08-17 08:04:20 +00:00
parent 81cd89bd43
commit ae44d27bfd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=161396

View File

@ -666,12 +666,17 @@ chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
$_chroot $command $rc_flags $command_args"
else
_doit="\
${_chdir:+cd $_chdir; }\
${_nice:+nice -n $_nice }\
${_chdir:+cd $_chdir && }\
$command $rc_flags $command_args"
if [ -n "$_user" ]; then
_doit="su -m $_user -c 'sh -c \"$_doit\"'"
fi
if [ -n "$_nice" ]; then
if [ -z "$_user" ]; then
_doit="sh -c \"$_doit\""
fi
_doit="nice -n $_nice $_doit"
fi
fi
# run the full command;