diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/exec/shbin/shbin.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/usr/src/uts/common/exec/shbin/shbin.c b/usr/src/uts/common/exec/shbin/shbin.c index 7720f9ea34..7fdd45793b 100644 --- a/usr/src/uts/common/exec/shbin/shbin.c +++ b/usr/src/uts/common/exec/shbin/shbin.c @@ -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 @@ checkshbinmagic(struct vnode *vp) return (0); } -int +static int shbinexec( struct vnode *vp, struct execa *uap, @@ -175,8 +175,6 @@ shbinexec( int fd = -1; int i; - (void) memset(&idata, 0, sizeof (idata)); - if (level) { /* Can't recurse */ error = ENOEXEC; goto bad; @@ -216,6 +214,16 @@ shbinexec( 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 */ |