Re: getenv return type

Bruno Haible via Gnulib discussion list <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs
Organization GNU
Message-ID <4539674.ejJDZkT8p0@nimes>
Alejandro Colomar wrote:
> getenv(3) should also be included in that list, I believe.  It is also
> in ISO C, so you may want to change it already, in order to provide
> prior art for WG14.

POSIX [1] allows some valid uses of writing into a string returned by getenv():
  "The application shall ensure that it does not modify the string pointed to
   by the getenv() function, unless it is part of a modifiable object
   previously placed in the environment by assigning a new value to environ
   or by using putenv()."

Therefore I wouldn't do this change for getenv().

Bruno

[1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/getenv.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.