Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Oct 2009 15:53:15 +0000 (UTC)
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r198189 - head/bin/csh
Message-ID:  <200910171553.n9HFrFCf045488@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ume
Date: Sat Oct 17 15:53:15 2009
New Revision: 198189
URL: http://svn.freebsd.org/changeset/base/198189

Log:
  Check error of dlfunc(3).
  
  MFC after:	3 days

Modified:
  head/bin/csh/iconv_stub.c

Modified: head/bin/csh/iconv_stub.c
==============================================================================
--- head/bin/csh/iconv_stub.c	Sat Oct 17 13:42:23 2009	(r198188)
+++ head/bin/csh/iconv_stub.c	Sat Oct 17 15:53:15 2009	(r198189)
@@ -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?200910171553.n9HFrFCf045488>