summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2009-10-20 11:52:39 +0000
committerume <ume@FreeBSD.org>2009-10-20 11:52:39 +0000
commitc24a7e0addfe9f65c30349c9245170c8ccad77b4 (patch)
tree550b329e5e1a0ec8d63e276e116bd68e9f68d089 /bin
parentff81d99085352c7cef9bd97930e54afdab61a749 (diff)
downloadFreeBSD-src-c24a7e0addfe9f65c30349c9245170c8ccad77b4.zip
FreeBSD-src-c24a7e0addfe9f65c30349c9245170c8ccad77b4.tar.gz
MFC r198189: Check error of dlfunc(3).
Approved by: re (kib)
Diffstat (limited to 'bin')
-rw-r--r--bin/csh/iconv_stub.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/csh/iconv_stub.c b/bin/csh/iconv_stub.c
index 6bbbbb0..d1a9e47 100644
--- a/bin/csh/iconv_stub.c
+++ b/bin/csh/iconv_stub.c
@@ -61,9 +61,20 @@ dl_iconv_open(const char *tocode, const char *fromcode)
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;
}
OpenPOWER on IntegriCloud