bin/64658: lastcomm dosen't accept arguments

MUKAIGAITO Takeya mkgt at box.email.ne.jp
Wed Mar 24 07:20:21 PST 2004


>Number:         64658
>Category:       bin
>Synopsis:       lastcomm dosen't accept arguments
>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 Mar 24 07:20:20 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     MUKAIGAITO Takeya
>Release:        5.2 Current
>Organization:
>Environment:
FreeBSD belfort 5.2-CURRENT FreeBSD 5.2-CURRENT #1: Fri Mar 19 16:31:28 JST 2004     root at belfort:/usr/obj/usr/src/sys/belfort  i386
>Description:
The lastcomm command dosen't accept arguments.

When I run lastcomm with an argument, it fails. e.g.

bash-2.05b# lastcomm who
lastcomm: /var/account/acct: Unknown error: 0
bash-2.05b#

>How-To-Repeat:
$ lastcomm command

>Fix:
When i run the lastcomm with some argments,
the next comparison in the main loop may become true.

if (*argv && !requested(argv, &ab))
	continue;

It would `continue' without fseeking the acct file.

The easiest and worst fix:

--- lastcomm.c.orig	Tue Jan 28 03:16:32 2003
+++ lastcomm.c	Wed Mar 24 18:57:09 2004
@@ -167,7 +167,7 @@
 				if (!isprint(*p))
 					*p = '?';
 		if (*argv && !requested(argv, &ab))
-			continue;
+			goto L1;;
 
 		(void)printf("%-*.*s %-7s %-*s %-*s",
 			     AC_COMM_LEN, AC_COMM_LEN, ab.ac_comm,
@@ -210,7 +210,7 @@
 			(void)printf(" %.16s", ctime(&t));
 		}
 		printf("\n");
-
+L1:
 		if (size == 0)
 			break;
 		size -= sizeof(struct acct);



>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list