Module Name: src
Committed By: simonb
Date: Sun Jun 13 14:58:50 UTC 2021
Modified Files:
src/sys/kern: subr_hash.c
Log Message:
Return ENOENT if the hashstat sysctl was called to query a specific hash
name and that hash name doesn't exist.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/subr_hash.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/kern/subr_hash.c
diff -u src/sys/kern/subr_hash.c:1.11 src/sys/kern/subr_hash.c:1.12
--- src/sys/kern/subr_hash.c:1.11 Sun Jun 13 14:02:46 2021
+++ src/sys/kern/subr_hash.c Sun Jun 13 14:58:49 2021
@@ -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 @@ hashstat_sysctl(SYSCTLFN_ARGS)
rw_exit(&hashstat_lock);
sysctl_relock();
+ if (query && written == 0) /* query not found? */
+ error = ENOENT;
+
*oldlenp = written;
return error;
}