svn commit: r194663 - head/lib/libkiconv

Xin LI delphij at FreeBSD.org
Mon Jun 22 21:49:56 UTC 2009


Author: delphij
Date: Mon Jun 22 21:49:55 2009
New Revision: 194663
URL: http://svn.freebsd.org/changeset/base/194663

Log:
  free(3) won't mess with errno so return it as-is.
  
  Submitted by:	Jaakko Heinonen <jh saunalahti fi>

Modified:
  head/lib/libkiconv/kiconv_sysctl.c

Modified: head/lib/libkiconv/kiconv_sysctl.c
==============================================================================
--- head/lib/libkiconv/kiconv_sysctl.c	Mon Jun 22 21:46:40 2009	(r194662)
+++ head/lib/libkiconv/kiconv_sysctl.c	Mon Jun 22 21:49:55 2009	(r194663)
@@ -39,7 +39,6 @@ int
 kiconv_lookupconv(const char *drvname)
 {
 	size_t size;
-	int error;
 
 	if (sysctlbyname("kern.iconv.drvlist", NULL, &size, NULL, 0) == -1)
 		return (errno);
@@ -50,7 +49,6 @@ kiconv_lookupconv(const char *drvname)
 		if (drivers == NULL)
 			return (ENOMEM);
 		if (sysctlbyname("kern.iconv.drvlist", drivers, &size, NULL, 0) == -1) {
-			error = errno;
 			free(drivers);
 			return (errno);
 		}
@@ -68,7 +66,6 @@ kiconv_lookupcs(const char *tocode, cons
 {
 	size_t i, size;
 	struct iconv_cspair_info *csi, *csip;
-	int error;
 
 	if (sysctlbyname("kern.iconv.cslist", NULL, &size, NULL, 0) == -1)
 		return (errno);
@@ -77,9 +74,8 @@ kiconv_lookupcs(const char *tocode, cons
 		if (csi == NULL)
 			return (ENOMEM);
 		if (sysctlbyname("kern.iconv.cslist", csi, &size, NULL, 0) == -1) {
-			error = errno;
 			free(csi);
-			return (error);
+			return (errno);
 		}
 		for (i = 0, csip = csi; i < (size/sizeof(*csi)); i++, csip++){
 			if (strcmp(csip->cs_to, tocode) == 0 &&


More information about the svn-src-head mailing list