Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Reorder two variables and fix some comments.



details:   https://anonhg.NetBSD.org/src/rev/d4bcd166726a
branches:  trunk
changeset: 330235:d4bcd166726a
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Jun 30 17:31:15 2014 +0000

description:
Reorder two variables and fix some comments.

diffstat:

 sys/kern/exec_script.c |  20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diffs (55 lines):

diff -r aa240fad6147 -r d4bcd166726a sys/kern/exec_script.c
--- a/sys/kern/exec_script.c    Mon Jun 30 17:22:32 2014 +0000
+++ b/sys/kern/exec_script.c    Mon Jun 30 17:31:15 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec_script.c,v 1.72 2014/06/30 17:22:32 maxv Exp $    */
+/*     $NetBSD: exec_script.c,v 1.73 2014/06/30 17:31:15 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.72 2014/06/30 17:22:32 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.73 2014/06/30 17:31:15 maxv Exp $");
 
 #if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)
 #define FDSCRIPTS              /* Need this for safe set-id scripts. */
@@ -138,11 +138,8 @@
                return ENOEXEC;
 
        /*
-        * check that the shell spec is terminated by a newline,
-        * and that it isn't too large.  Don't modify the
-        * buffer unless we're ready to commit to handling it.
-        * (The latter requirement means that we have to check
-        * for both spaces and tabs later on.)
+        * Check that the shell spec is terminated by a newline, and that
+        * it isn't too large.
         */
        hdrlinelen = min(epp->ep_hdrvalid, SCRIPT_HDR_SIZE);
        for (cp = hdrstr + EXEC_SCRIPT_MAGICLEN; cp < hdrstr + hdrlinelen;
@@ -155,10 +152,6 @@
        if (cp >= hdrstr + hdrlinelen)
                return ENOEXEC;
 
-       shellname = NULL;
-       shellarg = NULL;
-       shellarglen = 0;
-
        /* strip spaces before the shell name */
        for (cp = hdrstr + EXEC_SCRIPT_MAGICLEN; *cp == ' ' || *cp == '\t';
            cp++)
@@ -166,7 +159,10 @@
        if (*cp == '\0')
                return ENOEXEC;
 
-       /* collect the shell name; remember it's length for later */
+       shellarg = NULL;
+       shellarglen = 0;
+
+       /* collect the shell name; remember its length for later */
        shellname = cp;
        shellnamelen = 0;
        for ( /* cp = cp */ ; *cp != '\0' && *cp != ' ' && *cp != '\t'; cp++)



Home | Main Index | Thread Index | Old Index