On Sun, Jun 25, 2023 at 07:07:33PM -0300, Lucas de Sena wrote: > The manual already describes how posix_spawn(3) behaves when passing it > a NULL envp, but does not make it clear that it is an OpenBSD extension: > > > If envp is NULL, the environment is passed unchanged from the parent > > process. > > That differs from GNU/Linux, for example, where a NULL envp gives the > child an empty environment rather than a copy.
Note that a NULL environment is undefined behavior according to POSIX. If you read the OpenGroup description, it very clearly states that envp is a pointer to a NULL terminated array. Does GNU/Linux at least document that passing a NULL pointer means no environment for them ?