Fix invalid error report

cd:iconv returned an invalid ERROR_UNKNOW code instead of 'nil' on
successful conversions. This usually passes unnoticed since the return
string is what the user actually expects.
This commit is contained in:
Alexandre Erwin Ittner 2012-05-22 00:39:41 -03:00
parent 1876a6de19
commit 6f265ded5d

View File

@ -147,13 +147,14 @@ static int Liconv(lua_State *L) {
return 2; /* Unknown error */ return 2; /* Unknown error */
} }
} }
} while (ret != (size_t) 0); } while (ret == (size_t) -1);
lua_pushlstring(L, outbufs, obsize - obleft); lua_pushlstring(L, outbufs, obsize - obleft);
if (hasone == 1) if (hasone == 1)
lua_concat(L, 2); lua_concat(L, 2);
free(outbufs); free(outbufs);
return 1; /* Done */ lua_pushnil(L);
return 2; /* Done */
} }