aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2018-03-15 09:35:33 -0700
committerPaul Eggert2018-03-15 09:36:28 -0700
commit64a1da4989b0551481600facb1781ac92089d182 (patch)
tree20bdac9a212d1f42fa648ea69cdb846de4d2bde2 /src
parent711b94c8bb2d25bb3cd13be8b1f88feb2edbd186 (diff)
downloademacs-64a1da4989b0551481600facb1781ac92089d182.tar.gz
emacs-64a1da4989b0551481600facb1781ac92089d182.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 6ecc83fc302..d26319441b3 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -204,6 +204,18 @@ tzlookup (Lisp_Object zone, bool settz)
204 invalid_time_zone_specification (zone); 204 invalid_time_zone_specification (zone);
205 205
206 new_tz = tzalloc (zone_string); 206 new_tz = tzalloc (zone_string);
207
208#if defined __NetBSD_Version__ && __NetBSD_Version__ < 700000000
209 /* NetBSD 6 tzalloc mishandles POSIX TZ strings (Bug#30738).
210 If possible, fall back on tzdb. */
211 if (!new_tz && errno != ENOMEM && plain_integer
212 && XINT (zone) % (60 * 60) == 0)
213 {
214 sprintf (tzbuf, "Etc/GMT%+"pI"d", - (XINT (zone) / (60 * 60)));
215 new_tz = tzalloc (zone_string);
216 }
217#endif
218
207 if (!new_tz) 219 if (!new_tz)
208 { 220 {
209 if (errno == ENOMEM) 221 if (errno == ENOMEM)