PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp

This commit is contained in:
christos 2011-06-09 14:52:01 +00:00
parent b8b7a5e34c
commit 3a128b33dc

View File

@ -1,4 +1,4 @@
# $NetBSD: rc.subr,v 1.86 2010/09/26 18:37:14 apb Exp $
# $NetBSD: rc.subr,v 1.87 2011/06/09 14:52:01 christos Exp $
#
# Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
# All rights reserved.
@ -248,10 +248,17 @@ _find_processes()
read _interp < ${_chroot:-}/$_procname # read interpreter name
_interp=${_interp#\#!} # strip #!
set -- $_interp
if [ $1 = "/usr/bin/env" ]; then
shift
set -- $(type $1)
shift $(($# - 1))
_interp="${1##*/} $_procname"
else
_interp="$* $_procname"
fi
if [ $_interpreter != $1 ]; then
warn "\$command_interpreter $_interpreter != $1"
fi
_interp="$* $_procname" # cleanup spaces, add _procname
_interpbn=${1##*/}
_fp_args='_argv'
_fp_match='case "$_argv" in