Subject: bug#13070: Use putenv+unsetenv instead of modifying environ directly

From: Paul Eggert <[email-masked]>
Date: Sat, 08 Dec 2012 11:58:57 -0800

On 12/08/2012 10:31 AM, Eli Zaretskii wrote:

> What about NULL pointers?

putenv typically dumps core when passed NULL,
so checking errno afterwards wouldn't help.

> Or strings without a '='?

Typically that's valid; it's equivalent to unsetenv.
So typically, checking errno afterwards wouldn't help.

> it's silly to rely on unspecified behavior

Emacs doesn't rely on unspecified behavior, since it never
passes NULL or '='-less strings to xputenv.

Emacs has many, many places where we could
put easserts, but we don't bother because the disadvantages
of code clutter outweigh any advantages of catching bugs,
and this appears to be one of those places.