Date: Wed, 6 Jan 1999 17:45:51 GMT From: assar@sics.se To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/9349: make doesn't diagnose non-numeric arguments to `-j' (and `-L') Message-ID: <199901061745.RAA02896@mulet.e.kth.se>
next in thread | raw e-mail | index | archive | help
>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 <assar@sics.se> >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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901061745.RAA02896>