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.
This commit is contained in:
Ed Schouten 2009-01-01 00:19:51 +00:00
parent efcde1e8c7
commit 4cfe479098
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=186664

View File

@ -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);
}