Module Name:    src
Committed By:   christos
Date:           Thu Jun  9 14:52:01 UTC 2011

Modified Files:
        src/etc: rc.subr

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


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/etc/rc.subr

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/rc.subr
diff -u src/etc/rc.subr:1.86 src/etc/rc.subr:1.87
--- src/etc/rc.subr:1.86	Sun Sep 26 14:37:14 2010
+++ src/etc/rc.subr	Thu Jun  9 10:52:01 2011
@@ -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 @@
 		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

Reply via email to