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 2009-01-01 00:19:51 +00:00
parent a5f7e7ad63
commit 05475b9543

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