postgresql/src
Tom Lane 7ca37fb040 Use setenv() in preference to putenv().
Since at least 2001 we've used putenv() and avoided setenv(), on the
grounds that the latter was unportable and not in POSIX.  However,
POSIX added it that same year, and by now the situation has reversed:
setenv() is probably more portable than putenv(), since POSIX now
treats the latter as not being a core function.  And setenv() has
cleaner semantics too.  So, let's reverse that old policy.

This commit adds a simple src/port/ implementation of setenv() for
any stragglers (we have one in the buildfarm, but I'd not be surprised
if that code is never used in the field).  More importantly, extend
win32env.c to also support setenv().  Then, replace usages of putenv()
with setenv(), and get rid of some ad-hoc implementations of setenv()
wannabees.

Also, adjust our src/port/ implementation of unsetenv() to follow the
POSIX spec that it returns an error indicator, rather than returning
void as per the ancient BSD convention.  I don't feel a need to make
all the call sites check for errors, but the portability stub ought
to match real-world practice.

Discussion: https://postgr.es/m/2065122.1609212051@sss.pgh.pa.us
2020-12-30 12:56:06 -05:00
..
backend Use setenv() in preference to putenv(). 2020-12-30 12:56:06 -05:00
bin Use setenv() in preference to putenv(). 2020-12-30 12:56:06 -05:00
common Use setenv() in preference to putenv(). 2020-12-30 12:56:06 -05:00
fe_utils Remove incorrect %s in string 2020-11-09 10:38:22 +01:00
include Use setenv() in preference to putenv(). 2020-12-30 12:56:06 -05:00
interfaces Use setenv() in preference to putenv(). 2020-12-30 12:56:06 -05:00
makefiles
pl Further fix thinko in plpgsql memory leak fix. 2020-12-28 11:55:23 -05:00
port Use setenv() in preference to putenv(). 2020-12-30 12:56:06 -05:00
template On macOS, use -isysroot in link steps as well as compile steps. 2020-11-20 00:07:09 -05:00
test Use setenv() in preference to putenv(). 2020-12-30 12:56:06 -05:00
timezone Improve hash_create()'s API for some added robustness. 2020-12-15 11:38:53 -05:00
tools Use setenv() in preference to putenv(). 2020-12-30 12:56:06 -05:00
tutorial
.gitignore
DEVELOPERS
Makefile
Makefile.global.in
Makefile.shlib
nls-global.mk