summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/sysctl.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/gen/sysctl.c b/lib/libc/gen/sysctl.c
index fbc2c0c..a5a3d49 100644
--- a/lib/libc/gen/sysctl.c
+++ b/lib/libc/gen/sysctl.c
@@ -50,8 +50,11 @@ int
sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp,
const void *newp, size_t newlen)
{
- if (name[0] != CTL_USER)
- return (__sysctl(name, namelen, oldp, oldlenp, newp, newlen));
+ int retval;
+
+ retval = __sysctl(name, namelen, oldp, oldlenp, newp, newlen);
+ if (retval != -1 || errno != ENOENT || name[0] != CTL_USER)
+ return (retval);
if (newp != NULL) {
errno = EPERM;
OpenPOWER on IntegriCloud