Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Return ENOENT if the hashstat sysctl was called to ...



details:   https://anonhg.NetBSD.org/src/rev/33dcfbc52a0e
branches:  trunk
changeset: 1021698:33dcfbc52a0e
user:      simonb <simonb%NetBSD.org@localhost>
date:      Sun Jun 13 14:58:49 2021 +0000

description:
Return ENOENT if the hashstat sysctl was called to query a specific hash
name and that hash name doesn't exist.

diffstat:

 sys/kern/subr_hash.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r c5bc664ebde8 -r 33dcfbc52a0e sys/kern/subr_hash.c
--- a/sys/kern/subr_hash.c      Sun Jun 13 14:48:10 2021 +0000
+++ b/sys/kern/subr_hash.c      Sun Jun 13 14:58:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_hash.c,v 1.11 2021/06/13 14:02:46 christos Exp $  */
+/*     $NetBSD: subr_hash.c,v 1.12 2021/06/13 14:58:49 simonb Exp $    */
 
 /*
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.11 2021/06/13 14:02:46 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.12 2021/06/13 14:58:49 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
@@ -243,6 +243,9 @@
        rw_exit(&hashstat_lock);
        sysctl_relock();
 
+       if (query && written == 0)      /* query not found? */
+               error = ENOENT;
+
        *oldlenp = written;
        return error;
 }



Home | Main Index | Thread Index | Old Index