lua-users home
lua-l archive

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


It seems to me that if we get errors both from ferror() and from
fclose() the correct behavior would be to report *both* errors
somehow. Hiding an error is never helpful unless it is known to be
spurious at the time of implementation.

On Thu, May 14, 2020 at 12:16 PM Massimo Sala <massimo.sala.71@gmail.com> wrote:
>
> Ops, you are right:
>   The value of errno is zero at program startup, but is never set to
>   zero by any library function.
>
>
> Quoting the specifications, fclose can change errno.
>
> My point is still valid:
> in case of error the function must return the error message related to the failure.
>
> Not the error message of the fclose.
> It could be different; if different it is useless to troubleshoot the real problem.
>
> Thanks for your attention,
> M
>
>
> On Thu, 14 May 2020, 17:57 Roberto Ierusalimschy, <roberto@inf.puc-rio.br> wrote:
>>
>> > fclose can change errno.. . also reset it to zero.
>>
>> It cannot reset it. ISO C ensures this:
>>
>>   The value of errno is zero at program startup, but is never set to
>>   zero by any library function.
>>
>> -- 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
_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org