Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Oct 2009 11:52:39 +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-8@freebsd.org
Subject:   svn commit: r198276 - stable/8/bin/csh
Message-ID:  <200910201152.n9KBqd7T066113@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ume
Date: Tue Oct 20 11:52:39 2009
New Revision: 198276
URL: http://svn.freebsd.org/changeset/base/198276

Log:
  MFC r198189: Check error of dlfunc(3).
  
  Approved by:	re (kib)

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

Modified: stable/8/bin/csh/iconv_stub.c
==============================================================================
--- stable/8/bin/csh/iconv_stub.c	Tue Oct 20 10:40:01 2009	(r198275)
+++ stable/8/bin/csh/iconv_stub.c	Tue Oct 20 11:52:39 2009	(r198276)
@@ -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?200910201152.n9KBqd7T066113>