Module Name: src
Committed By: maxv
Date: Mon Jun 30 17:22:32 UTC 2014
Modified Files:
src/sys/kern: exec_script.c
Log Message:
If the interpreter is "", do not keep loading the script (which will later
fail), but return ENOEXEC directly.
ok christos@
To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/kern/exec_script.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/kern/exec_script.c
diff -u src/sys/kern/exec_script.c:1.71 src/sys/kern/exec_script.c:1.72
--- src/sys/kern/exec_script.c:1.71 Mon Jun 23 18:06:32 2014
+++ src/sys/kern/exec_script.c Mon Jun 30 17:22:32 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_script.c,v 1.71 2014/06/23 18:06:32 maxv Exp $ */
+/* $NetBSD: exec_script.c,v 1.72 2014/06/30 17:22:32 maxv Exp $ */
/*
* Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.71 2014/06/23 18:06:32 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.72 2014/06/30 17:22:32 maxv Exp $");
#if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)
#define FDSCRIPTS /* Need this for safe set-id scripts. */
@@ -163,12 +163,12 @@ exec_script_makecmds(struct lwp *l, stru
for (cp = hdrstr + EXEC_SCRIPT_MAGICLEN; *cp == ' ' || *cp == '\t';
cp++)
;
+ if (*cp == '\0')
+ return ENOEXEC;
/* collect the shell name; remember it's length for later */
shellname = cp;
shellnamelen = 0;
- if (*cp == '\0')
- goto check_shell;
for ( /* cp = cp */ ; *cp != '\0' && *cp != ' ' && *cp != '\t'; cp++)
shellnamelen++;
if (*cp == '\0')