From owner-freebsd-audit Tue Aug 14 1:52: 7 2001 Delivered-To: freebsd-audit@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 729) id 2D2AC37B408; Tue, 14 Aug 2001 01:52:03 -0700 (PDT) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0 To: freebsd-gnats-submit@FreeBSD.ORG Cc: freebsd-audit@FreeBSD.ORG Subject: Re: bin/29625: limits -d etc. should not output warning Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary="==_Exmh_9717437520" Message-Id: <20010814085203.2D2AC37B408@hub.freebsd.org> Date: Tue, 14 Aug 2001 01:52:03 -0700 (PDT) From: jkoshy@FreeBSD.ORG (Joseph Koshy) Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multipart MIME message. --==_Exmh_9717437520 Content-Type: text/plain The problem turns out to be in our implementation of `getopt(3)' and not in /usr/bin/limits. If 'optstring' passed to getopt() starts with a leading ':', then getopt() should not print a warning for missing arguments. The attached patch fixes this. Could someone on -audit please review? Regards, Koshy --==_Exmh_9717437520 Content-Type: text/plain ; name="getopt-patch" Content-Description: getopt-patch Content-Disposition: attachment; filename="getopt-patch" Index: getopt.c =================================================================== RCS file: /home/ncvs/src/lib/libc/stdlib/getopt.c,v retrieving revision 1.3 diff -u -r1.3 getopt.c --- getopt.c 2000/09/04 03:49:22 1.3 +++ getopt.c 2001/08/14 08:25:54 @@ -65,7 +65,6 @@ extern char *__progname; static char *place = EMSG; /* option letter processing */ char *oli; /* option letter list index */ - int ret; if (optreset || !*place) { /* update scanning pointer */ optreset = 0; @@ -105,14 +104,12 @@ else if (nargc <= ++optind) { /* no arg */ place = EMSG; if (*ostr == ':') - ret = BADARG; - else - ret = BADCH; + return (BADARG); if (opterr) (void)fprintf(stderr, "%s: option requires an argument -- %c\n", __progname, optopt); - return (ret); + return (BADCH); } else /* white space */ optarg = nargv[optind]; --==_Exmh_9717437520-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message