summaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-07-22 10:45:56 +0000
committerRoy Marples <roy@marples.name>2007-07-22 10:45:56 +0000
commitb67f71ca5dd4b21b1e342ce8f27a565093f25e44 (patch)
treedcbb9bef23199129572aaa76332a6221dc4f2211 /sh
parent9211d8b3dba78e03e09ee56d839e392fc13bf1c0 (diff)
downloadopenrc-b67f71ca5dd4b21b1e342ce8f27a565093f25e44.tar.gz
openrc-b67f71ca5dd4b21b1e342ce8f27a565093f25e44.tar.bz2
openrc-b67f71ca5dd4b21b1e342ce8f27a565093f25e44.tar.xz
Harden gendepends.sh some more so we only capture the stdout we want from
the depend function, #186072.
Diffstat (limited to 'sh')
-rwxr-xr-xsh/gendepends.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/sh/gendepends.sh b/sh/gendepends.sh
index 6c86f2a..0cb04e6 100755
--- a/sh/gendepends.sh
+++ b/sh/gendepends.sh
@@ -33,6 +33,9 @@ for SVCNAME in * ; do
SVCNAME=${SVCNAME##*/}
(
+ # Save stdout in fd3, then remap it to stderr
+ exec 3>&1 1>&2
+
rc_c=${SVCNAME%%.*}
if [ -n "${rc_c}" -a "${rc_c}" != "${SVCNAME}" ] ; then
[ -e /etc/conf.d/"${rc_c}" ] && . /etc/conf.d/"${rc_c}" >&2
@@ -42,6 +45,8 @@ for SVCNAME in * ; do
[ -e /etc/conf.d/"${SVCNAME}" ] && . /etc/conf.d/"${SVCNAME}" >&2
if . /etc/init.d/"${SVCNAME}" ; then
+ # Restore stdout now
+ exec 1>&3
echo "${SVCNAME}"
depend