[PATCH] posix: Handle negative fds in spawn's addfchdir
Collin Funk
collin.funk1@gmail.com
Wed Mar 25 21:27:29 GMT 2026
Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> writes:
> However, the POSIX requirements seems conflicting. It states that
>
> [EBADF]
> The value specified by fildes is negative or greater than or equal to {OPEN_MAX}.
>
> But at the same time it states that values potentially greater than
> OPEN_MAX are not necessary an error:
>
> "It shall not be considered an error for the fildes argument passed to these
> functions to specify a file descriptor for which the specified operation could
> not be performed"
>
> So I think the 'EBADF' is a 'shall fail' only for negative values,
> which seems the interpretation of musl and *BSD. I think it makes more sense.
Likewise. I assume they just forgot to remove the text from EBADF. I can
open a Austin Group bug report and send a patch after confirmation from
them.
Collin
More information about the Libc-alpha
mailing list