diff options
| author | Eli Zaretskii | 2015-06-04 18:28:29 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-06-04 18:28:29 +0300 |
| commit | 285260fce84c945acb588a7c70d3df5d8271f586 (patch) | |
| tree | e88e99bcbd6cf723c2fa5ba32f627c01b6f15248 /src | |
| parent | adc7d9e89c8fc3bda483b2b543d7774e8fde1bac (diff) | |
| download | emacs-285260fce84c945acb588a7c70d3df5d8271f586.tar.gz emacs-285260fce84c945acb588a7c70d3df5d8271f586.zip | |
Fix timezone-related functions on MS-Windows
* src/editfns.c (set_time_zone_rule) [WINDOWSNT]: Always call
'xputenv', even if no reallocation of tzvalbuf was necessary.
This fixes a bug in timezone-related functions on MS-Windows.
Reported by Fabrice Popineau <fabrice.popineau@gmail.com>.
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/editfns.c b/src/editfns.c index c387dc78c7d..bfa67e20e3e 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -2318,7 +2318,18 @@ set_time_zone_rule (const char *tzstring) | |||
| 2318 | tzval[tzeqlen] = 0; | 2318 | tzval[tzeqlen] = 0; |
| 2319 | } | 2319 | } |
| 2320 | 2320 | ||
| 2321 | if (new_tzvalbuf) | 2321 | if (new_tzvalbuf |
| 2322 | #ifdef WINDOWSNT | ||
| 2323 | /* MS-Windows implementation of 'putenv' copies the argument | ||
| 2324 | string into a block it allocates, so modifying tzval string | ||
| 2325 | does not change the environment. OTOH, the other threads run | ||
| 2326 | by Emacs on MS-Windows never call 'xputenv' or 'putenv' or | ||
| 2327 | 'unsetenv', so the original cause for the dicey in-place | ||
| 2328 | modification technique doesn't exist there in the first | ||
| 2329 | place. */ | ||
| 2330 | || 1 | ||
| 2331 | #endif | ||
| 2332 | ) | ||
| 2322 | { | 2333 | { |
| 2323 | /* Although this is not thread-safe, in practice this runs only | 2334 | /* Although this is not thread-safe, in practice this runs only |
| 2324 | on startup when there is only one thread. */ | 2335 | on startup when there is only one thread. */ |