emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] feature/gnus-select 520498d 091/218: Improve port to NetBS


From: Andrew G Cohen
Subject: [Emacs-diffs] feature/gnus-select 520498d 091/218: Improve port to NetBSD tzalloc
Date: Fri, 14 Dec 2018 03:35:08 -0500 (EST)

branch: feature/gnus-select
commit 520498d2bce8eca8bb8d224bfd5e5aa8ac97c307
Author: Paul Eggert <address@hidden>
Commit: Andrew G Cohen <address@hidden>

    Improve port to NetBSD tzalloc
    
    Problem reported by Valery Ushakov (Bug#30738#13).
    * src/editfns.c (tzlookup) [__NetBSD_Version__ < 700000000]:
    If tzalloc fails for any reason other than memory exhaustion,
    assume it’s because NetBSD 6 does not support tzalloc on
    POSIX-format TZ strings, and fall back on tzdb if possible.
---
 src/editfns.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/editfns.c b/src/editfns.c
index 6ecc83f..d263194 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -204,6 +204,18 @@ tzlookup (Lisp_Object zone, bool settz)
        invalid_time_zone_specification (zone);
 
       new_tz = tzalloc (zone_string);
+
+#if defined __NetBSD_Version__ && __NetBSD_Version__ < 700000000
+      /* NetBSD 6 tzalloc mishandles POSIX TZ strings (Bug#30738).
+        If possible, fall back on tzdb.  */
+      if (!new_tz && errno != ENOMEM && plain_integer
+         && XINT (zone) % (60 * 60) == 0)
+       {
+         sprintf (tzbuf, "Etc/GMT%+"pI"d", - (XINT (zone) / (60 * 60)));
+         new_tz = tzalloc (zone_string);
+       }
+#endif
+
       if (!new_tz)
        {
          if (errno == ENOMEM)



reply via email to

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