From dcd626dd7e766e70fc4996c774e0f61489d71d87 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 10 Apr 2002 06:08:16 +0000 Subject: change to root directory before staring/stopping; also sanitize environment (#53304, #61371) --- service | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'service') diff --git a/service b/service index 38d54a25..e178362a 100755 --- a/service +++ b/service @@ -11,6 +11,7 @@ if [ $# -eq 0 ]; then exit 1 fi +cd / while [ $# -gt 0 ] do case "${1}" in @@ -32,7 +33,7 @@ do ;; *) if [ -x "${SERVICEDIR}/${SERVICE}" ]; then - "${SERVICEDIR}/${SERVICE}" status + env -i "${SERVICEDIR}/${SERVICE}" status fi ;; esac @@ -42,8 +43,8 @@ do SERVICE="${1}" cd "${SERVICEDIR}" if [ -x "${SERVICEDIR}/${SERVICE}" ]; then - "${SERVICEDIR}/${SERVICE}" stop - "${SERVICEDIR}/${SERVICE}" start + env -i "${SERVICEDIR}/${SERVICE}" stop + env -i "${SERVICEDIR}/${SERVICE}" start exit $? fi elif [ -z "${SERVICE}" ]; then @@ -57,7 +58,7 @@ do done if [ -x "${SERVICEDIR}/${SERVICE}" ]; then - "${SERVICEDIR}/${SERVICE}" ${OPTIONS} + env -i "${SERVICEDIR}/${SERVICE}" ${OPTIONS} else echo $"${SERVICE}: unrecognized service" >&2 exit 1 -- cgit