Commit 81c497b3 authored by Herb Lewis's avatar Herb Lewis Committed by Gerald (Jerry) Carter
Browse files

r938: on an error save the original errno before calling iconv to reset

the conversion state
(This used to be commit 4a5a122b3a85c653bbf458342400f3b8a69dc615)
parent fe8977e1
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -129,7 +129,11 @@ static size_t sys_iconv(void *cd,
	size_t ret = iconv((iconv_t)cd, 
			   inbuf, inbytesleft, 
			   outbuf, outbytesleft);
	if (ret == (size_t)-1) iconv(cd, NULL, NULL, NULL, NULL);
	if (ret == (size_t)-1) {
		int saved_errno = errno;
		iconv(cd, NULL, NULL, NULL, NULL);
		errno = saved_errno;
	}
	return ret;
#else
	errno = EINVAL;