Index: libexec/rc/rc.subr =================================================================== --- libexec/rc/rc.subr +++ libexec/rc/rc.subr @@ -992,7 +992,7 @@ _nice=\$${name}_nice _user=\$${name}_user \ _group=\$${name}_group _groups=\$${name}_groups \ _fib=\$${name}_fib _env=\$${name}_env \ - _prepend=\$${name}_prepend _login_class=\${${name}_login_class:-daemon} \ + _prepend=\$${name}_prepend _login_class=\${${name}_login_class-daemon} \ _limits=\$${name}_limits _oomprotect=\$${name}_oomprotect \ _env_file=\$${name}_env_file @@ -1149,8 +1149,17 @@ fi fi - # Prepend default limits - _doit="$_cd limits -C $_login_class $_limits $_doit" + # prepend default limits + # if the login class and/or limits + # are provided + # + if [ -n "${_login_class}${_limits}" ]; then + _doit="limits ${_login_class:+-C $_login_class} $_limits $_doit" + fi + + # lastly, prepend the directory change + # + _doit="$_cd $_doit" # run the full command #