From nobody@FreeBSD.org  Wed Apr 18 18:17:56 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 4D36537B423
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 18 Apr 2001 18:17:56 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.1/8.11.1) id f3J1Hu182226;
	Wed, 18 Apr 2001 18:17:56 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200104190117.f3J1Hu182226@freefall.freebsd.org>
Date: Wed, 18 Apr 2001 18:17:56 -0700 (PDT)
From: reel@sympatico.ca
To: freebsd-gnats-submit@FreeBSD.org
Subject: logname returns error when passing opts args.
X-Send-Pr-Version: www-1.0

>Number:         26689
>Category:       bin
>Synopsis:       logname returns error when passing opts args.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 18 18:20:00 PDT 2001
>Closed-Date:    Tue Jun 5 14:04:47 PDT 2001
>Last-Modified:  Tue Jun 05 14:04:57 PDT 2001
>Originator:     Flix-Antoine Paradis
>Release:        FreeBSD 4.3-RC i386
>Organization:
Idemnia Networks
>Environment:
FreeBSD idemnia.ath.cx 4.3-RC FreeBSD 4.3-RC #2: Thu Apr 12 11:25:41
EDT 2001 reel@idemnia.ath.cx:/usr/src/sys/compile/ZEUS i386
>Description:
logname is a utility that prints the username on the standard output.
when doing: 'logname meuh', it returns my login name, when doing
'logname reel', it returns my login name, when I do 'logname -e', it
returns an error. As logname will always return the login whatever
the argument passed is, it still wants to know if we passed some
options to it. It doesn't have any options. Which means that it should
not normally call getopt() to see if there is options, as the next
switch only brings it to usage().
>How-To-Repeat:
Type: logname -e (or any other options...)
Note: logname --e will not give any errors.
>Fix:
Here is a patch:

--- /usr/src/usr.bin/logname/logname.c  Fri Mar 28 23:30:48 1997
+++ logname.c   Wed Apr 18 21:04:10 2001
@@ -55,15 +55,9 @@
        int argc;
        char *argv[];
 {
-       int ch;
        char *p;
-
-       while ((ch = getopt(argc, argv, "")) != -1)
-               switch (ch) {
-               case '?':
-               default:
-                       usage();
-               }
+       if (argc != 1)
+               usage();
        argc -= optind;
        argv += optind;

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: phk 
State-Changed-When: Tue Jun 5 14:04:47 PDT 2001 
State-Changed-Why:  
fixed, thanks! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=26689 
>Unformatted:
