Skip to content
Snippets Groups Projects
Commit 8c489744 authored by Vladislav Shpilevoy's avatar Vladislav Shpilevoy Committed by Kirill Yukhin
Browse files

iconv: take errno before reseting the context

In Lua iconv_convert() in case ffi.C.tnt_iconv() with normal
arguments failed, tried to clear iconv context by calling the
function again with all arguments NULL. Then it looked at errno.

But the second call could do anything with errno. For instance, it
could also fail, and change errno.

The patch saves errno into a variable before calling tnt_iconv()
second time.

It still does not give a perfect protection as it was discovered
in scope of #5632, but still better.

The patch is mostly motivated by the next patches about #5632
which will add another call to the error path, and it should
better be after errno save.

Needed for #5632
parent fabf0d57
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment