Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Oct 2009 13:49:34 +0000 (UTC)
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org
Subject:   svn commit: r198286 - stable/6/bin/csh
Message-ID:  <200910201349.n9KDnYvC068758@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ume
Date: Tue Oct 20 13:49:34 2009
New Revision: 198286
URL: http://svn.freebsd.org/changeset/base/198286

Log:
  MFC r198189: Check error of dlfunc(3).

Modified:
  stable/6/bin/csh/   (props changed)
  stable/6/bin/csh/iconv_stub.c

Modified: stable/6/bin/csh/iconv_stub.c
==============================================================================
--- stable/6/bin/csh/iconv_stub.c	Tue Oct 20 13:47:05 2009	(r198285)
+++ stable/6/bin/csh/iconv_stub.c	Tue Oct 20 13:49:34 2009	(r198286)
@@ -61,9 +61,20 @@ dl_iconv_open(const char *tocode, const 
 		if (iconvlib == NULL)
 			return (iconv_t)-1;
 		iconv_open = (iconv_open_t *)dlfunc(iconvlib, ICONV_OPEN);
+		if (iconv_open == NULL)
+			goto dlfunc_err;
 		dl_iconv = (dl_iconv_t *)dlfunc(iconvlib, ICONV_ENGINE);
+		if (dl_iconv == NULL)
+			goto dlfunc_err;
 		dl_iconv_close = (dl_iconv_close_t *)dlfunc(iconvlib,
 		    ICONV_CLOSE);
+		if (dl_iconv_close == NULL)
+			goto dlfunc_err;
 	}
 	return iconv_open(tocode, fromcode);
+
+dlfunc_err:
+	dlclose(iconvlib);
+	iconvlib = NULL;
+	return (iconv_t)-1;
 }



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