Module Name: src Committed By: christos Date: Tue Jan 11 22:55:55 UTC 2022
Modified Files: src/sys/miscfs/procfs: procfs_vnops.c Log Message: remove redundant error initialization and break earlier. (from rvp) To generate a diff of this commit: cvs rdiff -u -r1.223 -r1.224 src/sys/miscfs/procfs/procfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/miscfs/procfs/procfs_vnops.c diff -u src/sys/miscfs/procfs/procfs_vnops.c:1.223 src/sys/miscfs/procfs/procfs_vnops.c:1.224 --- src/sys/miscfs/procfs/procfs_vnops.c:1.223 Tue Jan 11 06:10:46 2022 +++ src/sys/miscfs/procfs/procfs_vnops.c Tue Jan 11 17:55:54 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_vnops.c,v 1.223 2022/01/11 11:10:46 hannken Exp $ */ +/* $NetBSD: procfs_vnops.c,v 1.224 2022/01/11 22:55:54 christos Exp $ */ /*- * Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc. @@ -105,7 +105,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.223 2022/01/11 11:10:46 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.224 2022/01/11 22:55:54 christos Exp $"); #include <sys/param.h> #include <sys/atomic.h> @@ -1483,7 +1483,7 @@ procfs_readdir(void *v) M_TEMP, M_WAITOK); *ap->a_cookies = cookies; } - error = 0; + /* 0 ... 3 are static entries. */ for (; i <= 3 && uio->uio_resid >= UIO_MX; i++) { switch (i) { @@ -1517,6 +1517,8 @@ procfs_readdir(void *v) if (cookies) *cookies++ = i + 1; } + if (error) + break; /* 4 ... are process entries. */ ctx.uiop = uio; ctx.error = 0;