[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13070: Use putenv+unsetenv instead of modifying environ directly
From: |
Paul Eggert |
Subject: |
bug#13070: Use putenv+unsetenv instead of modifying environ directly |
Date: |
Sat, 08 Dec 2012 11:58:57 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 |
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.