fixed user miscounting. reported by kim.

This commit is contained in:
christos 2002-08-22 14:52:55 +00:00
parent 2287052465
commit 52f955bcfd
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: w.c,v 1.49 2002/07/28 20:47:57 christos Exp $ */
/* $NetBSD: w.c,v 1.50 2002/08/22 14:52:55 christos Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1991, 1993, 1994\n\
#if 0
static char sccsid[] = "@(#)w.c 8.6 (Berkeley) 6/30/94";
#else
__RCSID("$NetBSD: w.c,v 1.49 2002/07/28 20:47:57 christos Exp $");
__RCSID("$NetBSD: w.c,v 1.50 2002/08/22 14:52:55 christos Exp $");
#endif
#endif /* not lint */
@ -237,7 +237,6 @@ main(int argc, char **argv)
while ((ut = getutent()) != NULL) {
if (ut->ut_name[0] == '\0')
continue;
++nusers;
if (wcmd == 0 || (sel_user &&
strncmp(ut->ut_name, sel_user, sizeof(ut->ut_name) != 0)))
continue;
@ -251,6 +250,7 @@ main(int argc, char **argv)
if (ep != NULL)
continue;
++nusers;
if ((ep = calloc(1, sizeof(struct entry))) == NULL)
err(1, NULL);
(void)memcpy(ep->name, ut->ut_name, sizeof(ut->ut_name));