Module Name:    src
Committed By:   christos
Date:           Tue Mar 21 22:52:10 UTC 2017

Modified Files:
        src/etc: rc.subr

Log Message:
Clear rc variables that contain state that is gone after the boot process
is complete, so that scripts invoked from powerd don't think that they
are still invoked by the rc system and fail.
Reported by rudolf @ tech-userlevel


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/etc/rc.subr

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/rc.subr
diff -u src/etc/rc.subr:1.98 src/etc/rc.subr:1.99
--- src/etc/rc.subr:1.98	Sun Mar  6 13:49:42 2016
+++ src/etc/rc.subr	Tue Mar 21 18:52:10 2017
@@ -1,4 +1,4 @@
-# $NetBSD: rc.subr,v 1.98 2016/03/06 18:49:42 christos Exp $
+# $NetBSD: rc.subr,v 1.99 2017/03/21 22:52:10 christos Exp $
 #
 # Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -36,6 +36,15 @@
 nl='
 ' # a literal newline
 
+# RC variables to clear on start.
+_env_clear_rc_vars="
+RC_PID=
+_rc_pid=
+_rc_original_stdout_fd=
+_rc_original_stderr_fd=
+_rc_postprocessor_fd=
+"
+
 #
 #	functions
 #	---------
@@ -665,14 +674,14 @@ EOF
 			echo "Starting ${name}."
 			if [ -n "$_chroot" ]; then
 				_doit="\
-${_env:+env $_env }\
+env $_env_clear_rc_vars $_env \
 ${_nice:+nice -n $_nice }\
 chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\
 $_chroot $command $rc_flags $command_args"
 			else
 				_doit="\
 ${_chdir:+cd $_chdir; }\
-${_env:+env $_env }\
+env $_env_clear_rc_vars $_env \
 ${_nice:+nice -n $_nice }\
 $command $rc_flags $command_args"
 				if [ -n "$_user" ]; then

Reply via email to