lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Roberto,
fclose can change errno.. . also reset it to zero.


Roberto:
What is the problem if the error reported
is a real error in 'fclose' instead of the previous error? 

We have incorrect error logging.
Is it ok for you?
Not for me, and I think also for other users.

I really don't understand the problem to fix it.
I wrote the patch, few lines, it is trivial.

M


On Thu, 14 May 2020, 16:34 Roberto Ierusalimschy, <roberto@inf.puc-rio.br> wrote:
> The function luaL_loadfilex ends with these lines:
>
>   readstatus = ferror(lf.f);
>   if (filename) fclose(lf.f);  /* close file (even in case of errors) */
>   if (readstatus) {
>     lua_settop(L, fnameindex);  /* ignore results from 'lua_load' */
>     return errfile(L, "read", fnameindex);
>   }
>
>
> I give a candy to anyone who sees the bug ;-)

I still fail to see the bug. What is the problem if the error reported
is a real error in 'fclose' instead of the previous error? More to the
point, do you have a concrete example where this issue causes any
harm or confusion?

-- Roberto
_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org
_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org