Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): remove unreachable code from CompatRun...



details:   https://anonhg.NetBSD.org/src/rev/c5c9003313bb
branches:  trunk
changeset: 943312:c5c9003313bb
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 30 20:08:47 2020 +0000

description:
make(1): remove unreachable code from CompatRunCommand

At the point where Str_Words is called, the string contains no
meta-characters.  This means that the parameter "expand" in Str_Words is
never looked at.  This in turn means that this parameter can be set to
FALSE, thereby making it impossible that Str_Words returns NULL.

diffstat:

 usr.bin/make/compat.c |  13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diffs (49 lines):

diff -r 80ccf3c55791 -r c5c9003313bb usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sun Aug 30 19:56:02 2020 +0000
+++ b/usr.bin/make/compat.c     Sun Aug 30 20:08:47 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.138 2020/08/30 19:56:02 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.139 2020/08/30 20:08:47 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.138 2020/08/30 19:56:02 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.139 2020/08/30 20:08:47 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c   8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.138 2020/08/30 19:56:02 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.139 2020/08/30 20:08:47 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -314,7 +314,6 @@
     if (DEBUG(JOB))
        fprintf(debug_file, "Execute: '%s'\n", cmd);
 
-again:
     if (useShell) {
        /*
         * We need to pass the command off to the shell, typically
@@ -345,13 +344,9 @@
         * No meta-characters, so no need to exec a shell. Break the command
         * into words to form an argument vector we can execute.
         */
-       Words words = Str_Words(cmd, TRUE);
+       Words words = Str_Words(cmd, FALSE);
        mav = words.words;
        bp = words.freeIt;
-       if (mav == NULL) {
-               useShell = 1;
-               goto again;
-       }
        av = (void *)mav;
     }
 



Home | Main Index | Thread Index | Old Index