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.


Index: posix_spawn.3
===================================================================
RCS file: /cvs/src/lib/libc/gen/posix_spawn.3,v
retrieving revision 1.9
diff -u -p -r1.9 posix_spawn.3
--- posix_spawn.3       17 Oct 2017 22:47:58 -0000      1.9
+++ posix_spawn.3       25 Jun 2023 21:38:47 -0000
@@ -122,6 +122,10 @@ with exit status 127.
 .Sh STANDARDS
 Both functions conform to
 .St -p1003.1-2001 .
+.Pp
+The handling of NULL
+.Fa envp
+is an extension to that standard.
 .Sh HISTORY
 These functions were ported from
 .Fx

Reply via email to