aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDima Dorfman <dd@FreeBSD.org>2001-06-03 04:58:51 +0000
committerDima Dorfman <dd@FreeBSD.org>2001-06-03 04:58:51 +0000
commitb8edb44cc349331b8ac053aea7b35a5822294e5f (patch)
tree9429df3f78529e26d1db6fbfb701f2b4005f86af
parent69f5c95465d443b06ca5edab5dc0f139a2080c60 (diff)
downloadsrc-b8edb44cc349331b8ac053aea7b35a5822294e5f.tar.gz
src-b8edb44cc349331b8ac053aea7b35a5822294e5f.zip
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 "".
Notes
Notes: svn path=/head/; revision=77646
-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 99f2d695c56f..b3bf555c4665 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;