Unportable(?) use of setenv() in secure_open_gssapi() - Mailing list pgsql-hackers

From Tom Lane
Subject Unportable(?) use of setenv() in secure_open_gssapi()
Date
Msg-id 30119.1576538578@sss.pgh.pa.us
Whole thread Raw
Responses Re: Unportable(?) use of setenv() in secure_open_gssapi()
List pgsql-hackers
I noticed while investigating [1] that we have one single solitary
use of setenv(3) in our code base, in secure_open_gssapi().

It's been project policy since 2001 to avoid setenv(), and I notice
that src/port/win32env.c lacks support for setenv(), making it
pretty doubtful that the call has the semantics one would wish
on Windows.

Now, versions of the POSIX spec released in this century do have setenv(),
and even seem to regard it as "more standard" than putenv().  So maybe
there's a case for moving our goalposts and deciding to allow use of
setenv().  But then it seems like we'd better twiddle win32env.c to
support it; and I'm not sure back-patching such a change would be wise.

Alternatively, we could change secure_open_gssapi() to use putenv(),
at the cost of a couple more lines of code.

Thoughts?

            regards, tom lane

[1]
https://www.postgresql.org/message-id/SN2PR05MB264066382E2CC75E734492C8E3510%40SN2PR05MB2640.namprd05.prod.outlook.com



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: ERROR: could not resize shared memory segment...No space left on device
Next
From: Andres Freund
Date:
Subject: reducing memory usage by using "proxy" memory contexts?