svn commit: r222699 - head/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Sat Jun 4 22:19:01 UTC 2011


Author: jilles
Date: Sat Jun  4 22:19:00 2011
New Revision: 222699
URL: http://svn.freebsd.org/changeset/base/222699

Log:
  sh: Improve error message if the script cannot be opened.
  
  Avoid "<nosuchfile>: cannot open <nosuchfile>: ...".

Modified:
  head/bin/sh/options.c

Modified: head/bin/sh/options.c
==============================================================================
--- head/bin/sh/options.c	Sat Jun  4 22:05:20 2011	(r222698)
+++ head/bin/sh/options.c	Sat Jun  4 22:19:00 2011	(r222699)
@@ -83,6 +83,7 @@ void
 procargs(int argc, char **argv)
 {
 	int i;
+	char *scriptname;
 
 	argptr = argv;
 	if (argc > 0)
@@ -105,8 +106,9 @@ procargs(int argc, char **argv)
 			optlist[i].val = 0;
 	arg0 = argv[0];
 	if (sflag == 0 && minusc == NULL) {
-		commandname = arg0 = *argptr++;
-		setinputfile(commandname, 0);
+		scriptname = *argptr++;
+		setinputfile(scriptname, 0);
+		commandname = arg0 = scriptname;
 	}
 	/* POSIX 1003.2: first arg after -c cmd is $0, remainder $1... */
 	if (argptr && minusc && *argptr)


More information about the svn-src-all mailing list