summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-01-15 22:20:16 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-01-15 22:20:16 +0000
commitc0553d9c8bfc1727cb48e933095c01c69790a787 (patch)
tree79cbbc689d0299f9cde40dd447d5f3bb8e86765f /usr.bin
parent45e8235cfb5c7433fa7550f8bb5a9fad18c39354 (diff)
Better fix for the sysctl() loop; deraadt@ OK
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/nfsstat/nfsstat.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/usr.bin/nfsstat/nfsstat.c b/usr.bin/nfsstat/nfsstat.c
index b58102ea5ab..54cf1fbe906 100644
--- a/usr.bin/nfsstat/nfsstat.c
+++ b/usr.bin/nfsstat/nfsstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfsstat.c,v 1.15 2003/01/15 21:25:44 millert Exp $ */
+/* $OpenBSD: nfsstat.c,v 1.16 2003/01/15 22:20:15 millert Exp $ */
/* $NetBSD: nfsstat.c,v 1.7 1996/03/03 17:21:30 thorpej Exp $ */
/*
@@ -48,7 +48,7 @@ static char copyright[] =
static char sccsid[] = "from: @(#)nfsstat.c 8.1 (Berkeley) 6/6/93";
static char *rcsid = "$NetBSD: nfsstat.c,v 1.7 1996/03/03 17:21:30 thorpej Exp $";
#else
-static char *rcsid = "$OpenBSD: nfsstat.c,v 1.15 2003/01/15 21:25:44 millert Exp $";
+static char *rcsid = "$OpenBSD: nfsstat.c,v 1.16 2003/01/15 22:20:15 millert Exp $";
#endif
#endif /* not lint */
@@ -161,7 +161,7 @@ main(argc, argv)
if (sysctl(mib, 3, &nfs_id, &len, NULL, 0))
err(1, "sysctl: VFS_MAXTYPENUM");
- do {
+ for (; nfs_id; nfs_id--) {
struct vfsconf vfsc;
mib[0] = CTL_VFS;
@@ -175,9 +175,8 @@ main(argc, argv)
if (!strcmp(vfsc.vfc_name, MOUNT_NFS))
break;
- } while (--nfs_id);
-
- if (nfs_id < 0)
+ }
+ if (nfs_id == 0)
errx(1, "cannot find nfs filesystem id");
}