From c3db6d03cc646aa71e183c33a529e02afc26732e Mon Sep 17 00:00:00 2001 From: yar Date: Sat, 10 Mar 2007 13:37:44 +0000 Subject: 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. --- etc/rc.subr | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'etc/rc.subr') 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 -- cgit v1.1