summaryrefslogtreecommitdiffstats
path: root/etc/rc.subr
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2007-03-10 13:37:44 +0000
committeryar <yar@FreeBSD.org>2007-03-10 13:37:44 +0000
commitc3db6d03cc646aa71e183c33a529e02afc26732e (patch)
tree19fc60d448fc27d73ae91411c786d80054befc14 /etc/rc.subr
parent578361cc4be813c142a9307fbeadaa386327e6e3 (diff)
downloadFreeBSD-src-c3db6d03cc646aa71e183c33a529e02afc26732e.zip
FreeBSD-src-c3db6d03cc646aa71e183c33a529e02afc26732e.tar.gz
Prepend ${_chroot} to a pathname in a consistent and robust way:
insert a slash between ${_chroot} and the pathname if and only if ${_chroot} is set to a non-empty string. Now the pathname is very likely to be absolute, but we shouldn't take that for granted.
Diffstat (limited to 'etc/rc.subr')
-rw-r--r--etc/rc.subr5
1 files changed, 3 insertions, 2 deletions
diff --git a/etc/rc.subr b/etc/rc.subr
index e938cbc..8cdb6e7 100644
--- a/etc/rc.subr
+++ b/etc/rc.subr
@@ -261,7 +261,8 @@ _find_processes()
_pref=
if [ $_interpreter != "." ]; then # an interpreted script
- read _interp < ${_chroot:-}/$_procname # read interpreter name
+ # read interpreter name
+ read _interp < ${_chroot}${_chroot:+"/"}$_procname
_interp=${_interp#\#!} # strip #!
set -- $_interp
case $1 in
@@ -613,7 +614,7 @@ run_rc_command()
return 1
fi
- if [ ! -x ${_chroot}${command} ]; then
+ if [ ! -x ${_chroot}${_chroot:+"/"}${command} ]; then
warn "run_rc_command: cannot run $command"
return 1
fi
OpenPOWER on IntegriCloud