Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jan 2009 00:19:51 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r186664 - head/sys/kern
Message-ID:  <200901010019.n010JpBu039017@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901010019.n010JpBu039017>