Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc Clear rc variables that contain state that is gone after...



details:   https://anonhg.NetBSD.org/src/rev/ae6055b7b912
branches:  trunk
changeset: 352225:ae6055b7b912
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 21 22:52:10 2017 +0000

description:
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

diffstat:

 etc/rc.subr |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r 729e56fd8e80 -r ae6055b7b912 etc/rc.subr
--- a/etc/rc.subr       Tue Mar 21 21:42:18 2017 +0000
+++ b/etc/rc.subr       Tue Mar 21 22:52:10 2017 +0000
@@ -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 @@
                        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



Home | Main Index | Thread Index | Old Index