> On 6 Sep 2022, at 09:26, Antonin Houska <ah@cybertec.at> wrote:
>
> I've noticed that some callers of PathNameOpenFile()
> (e.g. bbsink_server_begin_archive()) consider the call failed even if the
> function returned zero, while other ones do check whether the file descriptor
> is strictly negative. Since the file descriptor is actually returned by the
> open() system call, I assume that zero is a valid result, isn't it?
Agreed, zero should be valid as it's a non-negative integer. However, callers
in fd.c are themselves checking for (fd <= 0) in some cases, and some have done
so since the very early days of the codebase, so I wonder if there historically
used to be a platform which considered 0 an invalid fd?
--
Daniel Gustafsson https://vmware.com/