Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: putenv/setenv changes



On Sat, Oct 02, 2010 at 11:40:12PM +0000, Christos Zoulas wrote:
> >I suggest a BUGS section in putenv(3) stating that that the interface
> >uses non-const char* for compatibility with POSIX brain damage, but the
> >implementation guarantees to treat it as read-only.
> 
> Actually the string must be writeable because POSIX requires you
> to use the actual string passed to putenv() inside the environment
> array. All strings in the environment array must be writable. I am
> ambivalent about the binary compatibility restoration, ...

I think it is important. There are several binaries distributed with
NetBSD which did that ("cron", "date" and "rcp") or still do that
(all of Postfix's setuid programs). There are probably a lot more
in "pkgsrc" and it would be very bad if all of those suddenly
start crashing after an upgrade to NetBSD 6.0.

> ... because while it fixes the common case, it might break programs
> that use both putenv and setenv (hopefully none).

It shouldn't. I've tried to take care of that with the second half
of the change. setenv(3) will not try to write to an environment
string that it didn't allocate itself.

        Kind regards

-- 
Matthias Scheler                                  http://zhadum.org.uk/


Home | Main Index | Thread Index | Old Index