Fix unloading of libiconv module.

Previously it would either loop infinitely or exit with error leaking a lock.

Reported by:	Will DeVries
Approved by:	trasz (mentor)
MFC after:	1 week
This commit is contained in:
Mateusz Guzik 2012-06-11 17:42:39 +00:00
parent 7aa2051e40
commit 414d9b2ed0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=236899

View File

@ -84,9 +84,11 @@ iconv_mod_unload(void)
struct iconv_cspair *csp;
sx_xlock(&iconv_lock);
while ((csp = TAILQ_FIRST(&iconv_cslist)) != NULL) {
if (csp->cp_refcount)
TAILQ_FOREACH(csp, &iconv_cslist, cp_link) {
if (csp->cp_refcount) {
sx_xunlock(&iconv_lock);
return EBUSY;
}
}
while ((csp = TAILQ_FIRST(&iconv_cslist)) != NULL)