Bug 29625

Summary: limits -d etc. should not output warning
Product: Base System Reporter: Slaven Rezic <eserte>
Component: binAssignee: Joseph Koshy <jkoshy>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.3-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
getopt-patch none

Description Slaven Rezic 2001-08-11 15:10:01 UTC
	If I type

		limits -d

	I get a warning and the correct result:

	limits: option requires an argument -- d
	Resource limits (current):
	  datasize           524288 kb

	The warning should not be there. Same with other options (-c etc.).

Fix: 

I'm not sure whether the functionality (option takes
	optionally an argument) can be achieved with getopt(3).
How-To-Repeat: 	See above
Comment 1 Joseph Koshy freebsd_committer freebsd_triage 2001-08-14 08:56:43 UTC
Responsible Changed
From-To: freebsd-bugs->jkoshy

I'll take care of this.
Comment 2 Joseph Koshy freebsd_committer freebsd_triage 2001-08-14 09:52:03 UTC
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
<jkoshy@freebsd.org>
Comment 3 mheffner 2001-08-15 22:26:28 UTC
On 14-Aug-2001 Joseph Koshy wrote:
| 
| 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?

Looks good. Is this to be an MFC candidate?

Mike

-- 
  Mike Heffner         <mheffner@[acm.]vt.edu>
  Fredericksburg, VA       <mikeh@FreeBSD.org>
Comment 4 Joseph Koshy freebsd_committer freebsd_triage 2001-08-16 04:30:55 UTC
State Changed
From-To: open->closed

Fixed in rev 1.4 of "src/lib/libc/stdlib/getopt.c".