changeset 10205:4c854da9e3ee

6862121 shbinexec kernel module defunct
author Roland Mainz <roland.mainz@nrubsig.org>
date Wed, 29 Jul 2009 13:13:08 -0700
parents 83c3a84aecef
children 51f52702df72
files usr/src/uts/common/exec/shbin/shbin.c
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/exec/shbin/shbin.c	Wed Jul 29 14:12:34 2009 -0700
+++ b/usr/src/uts/common/exec/shbin/shbin.c	Wed Jul 29 13:13:08 2009 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -46,8 +46,8 @@
  */
 #include <sys/modctl.h>
 
-/* Prototype */
-int
+/* Local prototypes */
+static int
 shbinexec(
 	struct vnode *vp,
 	struct execa *uap,
@@ -151,7 +151,7 @@
 	return (0);
 }
 
-int
+static int
 shbinexec(
 	struct vnode *vp,
 	struct execa *uap,
@@ -175,8 +175,6 @@
 	int fd = -1;
 	int i;
 
-	(void) memset(&idata, 0, sizeof (idata));
-
 	if (level) {		/* Can't recurse */
 		error = ENOEXEC;
 		goto bad;
@@ -216,6 +214,16 @@
 		goto fail;
 	}
 
+	/*
+	 * Setup interpreter data
+	 * "--" is passed to mark the end-of-arguments before adding
+	 * the scripts file name, preventing problems when a
+	 * a script's name starts with a '-' character.
+	 */
+	idata.intp = NULL;
+	idata.intp_name = shell_list[i];
+	idata.intp_arg = "--";
+
 	opath = args->pathname;
 	args->pathname = resolvepn.pn_path;
 	/* don't free resolvepn until we are done with args */