--- etc/rc.subr.orig 2017-03-19 15:04:05.000000000 +0100
+++ etc/rc.subr 2017-03-19 15:15:36.000000000 +0100
@@ -663,18 +663,22 @@
# setup the command to run, and run it
#
echo "Starting ${name}."
+ exported_rc_vars="RC_PID _rc_pid \
+_rc_original_stdout_fd _rc_original_stderr_fd _rc_postprocessor_fd"
if [ -n "$_chroot" ]; then
- _doit="\
+ _doit="(\
+unset $exported_rc_vars; \
${_env:+env $_env }\
${_nice:+nice -n $_nice }\
chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
-$_chroot $command $rc_flags $command_args"
+$_chroot $command $rc_flags $command_args)"
else
- _doit="\
+ _doit="(\
+unset $exported_rc_vars; \
${_chdir:+cd $_chdir; }\
${_env:+env $_env }\
${_nice:+nice -n $_nice }\
-$command $rc_flags $command_args"
+$command $rc_flags $command_args)"
if [ -n "$_user" ]; then
_doit="su -m $_user -c 'sh -c \"$_doit\"'"
fi
- why kill those only for 'start'? I guess it is only important for start,
but...
- I don't think think that the parens are needed; after all the cd command
is separate.
@@ -818,6 +822,7 @@
[ -n "${_rc_postprocessor_fd}" ] || { unset _rc_pid; return 1; }
eval ": >&${_rc_postprocessor_fd}" 2>/dev/null \
|| { unset _rc_pid; return 1; }
+ fdflags -s +cloexec "${_rc_postprocessor_fd}"
I think this belongs to rc, where the fd is created and I've committed
the fdflags line there.