https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124330
--- Comment #6 from dave.anglin at bell dot net ---
On 2026-03-02 4:44 p.m., jvdelisle at gcc dot gnu.org wrote:
> Reviewing, I may have a few tweaks. My understanding is that the environment
> variables are being set at run time so they can be read by other processes.
> This implies some sort of persistance. For putenv I read that it saves a
> pointer to the string so I think we need to make that buffer static for the
> duration of execution.
The HP-UX manpage says putenv uses malloc to expand the environment:
putenv() returns non-zero if it was unable to obtain enough space via
malloc() for an expanded environment, or if an invalid multibyte
character sequence was encountered in the string argument; otherwise
it returns zero.
It returns ENOMEM if there is is insufficient space to expand the environment.
So, it behaves the same as setenv on Linux.
Don't know about other systems.