mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-27 11:20:58 +01:00
Check error of dlfunc(3).
MFC after: 3 days
This commit is contained in:
parent
04a930203d
commit
ec8bf5ddac
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user