summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authordd <dd@FreeBSD.org>2001-06-03 04:58:51 +0000
committerdd <dd@FreeBSD.org>2001-06-03 04:58:51 +0000
commite9e92e57f1837e7d5219b2b4c7000bf903f6a000 (patch)
tree8d0442d5ed01306a898f01dc9a93fc94b94d2a2a /sys/kern
parent4a336ef7291b1a8d8caf57c1169b21615ed48078 (diff)
downloadFreeBSD-src-e9e92e57f1837e7d5219b2b4c7000bf903f6a000.zip
FreeBSD-src-e9e92e57f1837e7d5219b2b4c7000bf903f6a000.tar.gz
When tring to find out if this is a request for a write in
kernel_sysctl and userland_sysctl, check for whether new is NULL, not whether newlen is 0. This allows one to set a string sysctl to "".
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_sysctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 99f2d69..b3bf555 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -862,7 +862,7 @@ kernel_sysctl(struct proc *p, int *name, u_int namelen, void *old,
req.oldptr= old;
}
- if (newlen) {
+ if (new != NULL) {
req.newlen = newlen;
req.newptr = new;
}
@@ -1126,7 +1126,7 @@ userland_sysctl(struct proc *p, int *name, u_int namelen, void *old, size_t *old
req.oldptr= old;
}
- if (newlen) {
+ if (new != NULL) {
if (!useracc(new, req.newlen, VM_PROT_READ))
return (EFAULT);
req.newlen = newlen;
OpenPOWER on IntegriCloud