emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 285260f: Fix timezone-related functions on MS-Windo


From: Eli Zaretskii
Subject: [Emacs-diffs] master 285260f: Fix timezone-related functions on MS-Windows
Date: Thu, 04 Jun 2015 15:29:42 +0000

branch: master
commit 285260fce84c945acb588a7c70d3df5d8271f586
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    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 <address@hidden>.
---
 src/editfns.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/editfns.c b/src/editfns.c
index c387dc7..bfa67e2 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2318,7 +2318,18 @@ set_time_zone_rule (const char *tzstring)
       tzval[tzeqlen] = 0;
     }
 
-  if (new_tzvalbuf)
+  if (new_tzvalbuf
+#ifdef WINDOWSNT
+      /* MS-Windows implementation of 'putenv' copies the argument
+        string into a block it allocates, so modifying tzval string
+        does not change the environment.  OTOH, the other threads run
+        by Emacs on MS-Windows never call 'xputenv' or 'putenv' or
+        'unsetenv', so the original cause for the dicey in-place
+        modification technique doesn't exist there in the first
+        place.  */
+      || 1
+#endif
+      )
     {
       /* Although this is not thread-safe, in practice this runs only
         on startup when there is only one thread.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]