From owner-freebsd-bugs Wed Jan 6 09:50:12 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA12673 for freebsd-bugs-outgoing; Wed, 6 Jan 1999 09:50:12 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA12662 for ; Wed, 6 Jan 1999 09:50:09 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id JAA26733; Wed, 6 Jan 1999 09:50:03 -0800 (PST) Received: from mulet.e.kth.se (mulet.e.kth.se [130.237.43.20]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA12266 for ; Wed, 6 Jan 1999 09:46:20 -0800 (PST) (envelope-from root@mulet.e.kth.se) Received: (from root@localhost) by mulet.e.kth.se (8.9.1/8.9.1) id RAA02896; Wed, 6 Jan 1999 17:45:51 GMT (envelope-from root) Message-Id: <199901061745.RAA02896@mulet.e.kth.se> Date: Wed, 6 Jan 1999 17:45:51 GMT From: assar@sics.se To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: bin/9349: make doesn't diagnose non-numeric arguments to `-j' (and `-L') Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 9349 >Category: bin >Synopsis: make doesn't diagnose non-numeric arguments to `-j' (and `-L') >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jan 6 09:50:03 PST 1999 >Closed-Date: >Last-Modified: >Originator: Assar Westerlund >Release: FreeBSD 3.0-CURRENT i386 >Organization: none >Environment: >Description: make calls `atoi' instead of `strtol' to find errors with argument to `-j', therefore not finding non-numeric arguments. >How-To-Repeat: make -j foobar >Fix: =================================================================== RCS file: RCS/main.c,v retrieving revision 1.1 diff -uw -r1.1 main.c --- main.c 1999/01/06 17:33:11 1.1 +++ main.c 1999/01/06 17:41:07 @@ -204,11 +204,19 @@ Var_Append(MAKEFLAGS, "-B", VAR_GLOBAL); break; #ifdef REMOTE - case 'L': - maxLocal = atoi(optarg); + case 'L': { + char *endptr; + + maxLocal = strtol(optarg, &endptr, 0); + if (maxLocal == 0 && endptr == optarg) { + warnx("non-numeric argument to -L -- %s", + optarg); + usage(); + } Var_Append(MAKEFLAGS, "-L", VAR_GLOBAL); Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL); break; + } #endif case 'P': usePipes = FALSE; @@ -282,15 +290,23 @@ ignoreErrors = TRUE; Var_Append(MAKEFLAGS, "-i", VAR_GLOBAL); break; - case 'j': + case 'j': { + char *endptr; + forceJobs = TRUE; - maxJobs = atoi(optarg); + maxJobs = strtol(optarg, &endptr, 0); + if (maxJobs == 0 && endptr == optarg) { + warnx("non-numeric argument to -j -- %s", + optarg); + usage(); + } #ifndef REMOTE maxLocal = maxJobs; #endif Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL); Var_Append(MAKEFLAGS, optarg, VAR_GLOBAL); break; + } case 'k': keepgoing = TRUE; Var_Append(MAKEFLAGS, "-k", VAR_GLOBAL); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message