unsetenv() patch for TZ

Howland Craig D (Craig) howland@LGSInnovations.com
Mon Jul 11 12:13:00 GMT 2011

The current implementation of _setenv_r() looks to see if the
variable being set (or changed) is TZ, calling tzset() when it is so
the timezone is automatically kept matching the environment without user
However, _unsetenv_r() does not provide the same feature, likely leading
to a problem when TZ is unset.
POSIX says nothing about this feature under setenv() and unsetenv(),
so it would be possible to make the behavior consistent by either adding
to unset or removing from set.  However, adding to unset seems far less
likely to cause backwards-compatibility problems than removing from set.

The attached patch addresses the issue by adding a tzset() call to
_unsetenv_r() when TZ is unset.

2011-07-08  Craig Howland <howland@LGSInnovations.com>

	* libc/stdlib/setenv_r.c (_unsetenv_r):  Call tzset() when TZ is
	unset, to match similar _setenv_r() behavior.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: setenv_r.patch.txt
URL: <http://sourceware.org/pipermail/newlib/attachments/20110711/097e6863/attachment.txt>

More information about the Newlib mailing list