Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Apr 2001 18:17:56 -0700 (PDT)
From:      reel@sympatico.ca
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/26689: logname returns error when passing opts args.
Message-ID:  <200104190117.f3J1Hu182226@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         26689
>Category:       bin
>Synopsis:       logname returns error when passing opts args.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 18 18:20:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Félix-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:
>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?200104190117.f3J1Hu182226>