svn commit: r186664 - head/sys/kern

Ed Schouten ed at FreeBSD.org
Thu Jan 1 00:19:52 UTC 2009


Author: ed
Date: Thu Jan  1 00:19:51 2009
New Revision: 186664
URL: http://svn.freebsd.org/changeset/base/186664

Log:
  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.

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==============================================================================
--- head/sys/kern/kern_sysctl.c	Wed Dec 31 23:44:34 2008	(r186663)
+++ head/sys/kern/kern_sysctl.c	Thu Jan  1 00:19:51 2009	(r186664)
@@ -1371,8 +1371,11 @@ __sysctl(struct thread *td, struct sysct
 		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);
 }
 


More information about the svn-src-head mailing list