3 ms·
Good point about `putenv()`; however there is also `setenv()`, which does make a copy, so you are wrong about `getenv()` in general. POSIX explicitly states "T
by hddqsb 3y ago
Good point about `putenv()`; however there is also `setenv()`, which does make a copy, so you are wrong about `getenv()` in general.
POSIX explicitly states "The string [returned by getenv] may be overwritten by a subsequent call to getenv(), setenv(), unsetenv(), or putenv()" (https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/getenv.html https://pubs.opengroup.org/onlinepubs/9699919799.2008edition...).
- cryptonector 3y ago"May", but really, it's best for `setenv()` to leak.