diff options
author | Ed Schouten <ed@FreeBSD.org> | 2009-01-01 00:19:51 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2009-01-01 00:19:51 +0000 |
commit | 4cfe47909807a6485b63e28bf803c78cfac3f615 (patch) | |
tree | 5111170fc8fb0cf0641276df8870c32e733f37bc /sys/kern/kern_sysctl.c | |
parent | efcde1e8c796f8a1cbf26c67f08e65718b004a6f (diff) | |
download | src-4cfe47909807a6485b63e28bf803c78cfac3f615.tar.gz src-4cfe47909807a6485b63e28bf803c78cfac3f615.zip |
Don't clobber sysctl_root()'s error number.
When sysctl() is being called with a buffer that is too small, it will
return ENOMEM. Unfortunately the changes I made the other day sets the
error number to 0, because it just returns the error number of the
copyout(). Revert this part of the change.
Notes
Notes:
svn path=/head/; revision=186664
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r-- | sys/kern/kern_sysctl.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 35dc3dc794dd..e56c48148225 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1371,8 +1371,11 @@ __sysctl(struct thread *td, struct sysctl_args *uap) uap->new, uap->newlen, &j, 0); if (error && error != ENOMEM) return (error); - if (uap->oldlenp) - error = copyout(&j, uap->oldlenp, sizeof(j)); + if (uap->oldlenp) { + int i = copyout(&j, uap->oldlenp, sizeof(j)); + if (i) + return (i); + } return (error); } |