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): parse the internal option -J strictly



details:   https://anonhg.NetBSD.org/src/rev/60b1f0e1ca0e
branches:  trunk
changeset: 1016068:60b1f0e1ca0e
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Nov 08 01:52:24 2020 +0000

description:
make(1): parse the internal option -J strictly

diffstat:

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

diffs (37 lines):

diff -r fc367b3a3532 -r 60b1f0e1ca0e usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sun Nov 08 01:43:58 2020 +0000
+++ b/usr.bin/make/main.c       Sun Nov 08 01:52:24 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.439 2020/11/08 01:43:58 rillig Exp $        */
+/*     $NetBSD: main.c,v 1.440 2020/11/08 01:52:24 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -109,7 +109,7 @@
 #include "trace.h"
 
 /*     "@(#)main.c     8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.439 2020/11/08 01:43:58 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.440 2020/11/08 01:52:24 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
            "The Regents of the University of California.  "
@@ -215,7 +215,7 @@
        snprintf(fname + len - 2, 20, "%d", getpid());
 
     opts.debug_file = fopen(fname, mode);
-    if (!opts.debug_file) {
+    if (opts.debug_file == NULL) {
        fprintf(stderr, "Cannot open debug file %s\n",
                fname);
        usage();
@@ -375,7 +375,8 @@
 static void
 MainParseArgJobsInternal(const char *argvalue)
 {
-       if (sscanf(argvalue, "%d,%d", &jp_0, &jp_1) != 2) {
+       char end;
+       if (sscanf(argvalue, "%d,%d%c", &jp_0, &jp_1, &end) != 2) {
                (void)fprintf(stderr,
                              "%s: internal error -- J option malformed (%s)\n",
                              progname, argvalue);



Home | Main Index | Thread Index | Old Index