diff options
author | ed <ed@FreeBSD.org> | 2009-01-01 00:19:51 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-01-01 00:19:51 +0000 |
commit | 05475b9543d9864dc29a307affe7e03706cac326 (patch) | |
tree | 5111170fc8fb0cf0641276df8870c32e733f37bc /sys | |
parent | a5f7e7ad63dfd015e88327967321a8f8eff0dc17 (diff) | |
download | FreeBSD-src-05475b9543d9864dc29a307affe7e03706cac326.zip FreeBSD-src-05475b9543d9864dc29a307affe7e03706cac326.tar.gz |
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.
Diffstat (limited to 'sys')
-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 35dc3dc..e56c481 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); } |