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.
This commit is contained in:
Yaroslav Tykhiy 2007-03-10 13:37:44 +00:00
parent 4806fea24e
commit b5af060613
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167413

View File

@ -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