Am Sat, 18 Jun 2022 16:19:43 +0300
schrieb Eero Tamminen <oak@xxxxxxxxxxxxxx>:
On 18.6.2022 16.05, Eero Tamminen wrote:
Anyway, since EOF is guaranteed to be negative, it shouldn't
really matter much in this case, so never mind, let's just
leave the code as it is.
I think I need to update logging to check errno instead of return value.
Now it ignores all errors as they all get mapped to EOF return value.
Does attached patch look OK? I mean, can we trust on errno being set
(glibc fgetc manual does not say anything about errno)...
I don't think this is ok yet: According to the 3p man page of fgetc, errno
only gets set on errors, not on end-of-file conditions, so I think you
explicitely have to clear errno first if you want to check it afterwards.