Subject: bin/2289: w should use errx instead of err
To: None <gnats-bugs@NetBSD.ORG>
From: None <kashmir@umiacs.UMD.EDU>
List: netbsd-bugs
Date: 04/02/1996 08:33:15
>Number:         2289
>Category:       bin
>Synopsis:       w calls err when errno is not valid
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr  2 08:50:02 1996
>Last-Modified:
>Originator:     Mike Grupenhoff
>Organization:
oof
>Release:        -current of 3/26/96
>Environment:
System: NetBSD snarf.dorm.umd.edu 1.1B NetBSD 1.1B (SNARF) #65: Mon Apr 1 23:20:12 EST 1996 root@snarf.dorm.umd.edu:/usr/src/sys/arch/i386/compile/SNARF i386


>Description:
	When kvm_getprocs() returns null in w, w uses err() to report
	the error.  However, errno contains nothing usefull.
>How-To-Repeat:
	Run a kernel with a w that have different ideas of what struct
	proc looks like.  Notce the error message produced has
	"Undefined error 0" appended.
>Fix:
Index: w.c
===================================================================
RCS file: /snarf/netbsd/master/src/usr.bin/w/w.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 w.c
--- w.c	1995/11/16 02:28:51	1.1.1.1
+++ w.c	1996/04/02 01:37:18
@@ -222,7 +222,7 @@
 	(void)printf(HEADER);
 
 	if ((kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nentries)) == NULL)
-		err(1, "%s", kvm_geterr(kd));
+		errx(1, "%s", kvm_geterr(kd));
 	for (i = 0; i < nentries; i++, kp++) {
 		struct proc *p = &kp->kp_proc;
 		struct eproc *e;
>Audit-Trail:
>Unformatted: