diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/editfns.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/editfns.c b/src/editfns.c index cb7353a48c6..7e35fe87972 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -48,6 +48,16 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 48 | #include <float.h> | 48 | #include <float.h> |
| 49 | #include <limits.h> | 49 | #include <limits.h> |
| 50 | 50 | ||
| 51 | #ifdef HAVE_TIMEZONE_T | ||
| 52 | # include <sys/param.h> | ||
| 53 | # if defined __NetBSD_Version__ && __NetBSD_Version__ < 700000000 | ||
| 54 | # define HAVE_TZALLOC_BUG true | ||
| 55 | # endif | ||
| 56 | #endif | ||
| 57 | #ifndef HAVE_TZALLOC_BUG | ||
| 58 | # define HAVE_TZALLOC_BUG false | ||
| 59 | #endif | ||
| 60 | |||
| 51 | #include <c-ctype.h> | 61 | #include <c-ctype.h> |
| 52 | #include <intprops.h> | 62 | #include <intprops.h> |
| 53 | #include <stdlib.h> | 63 | #include <stdlib.h> |
| @@ -205,16 +215,14 @@ tzlookup (Lisp_Object zone, bool settz) | |||
| 205 | 215 | ||
| 206 | new_tz = tzalloc (zone_string); | 216 | new_tz = tzalloc (zone_string); |
| 207 | 217 | ||
| 208 | #if defined __NetBSD_Version__ && __NetBSD_Version__ < 700000000 | 218 | if (HAVE_TZALLOC_BUG && !new_tz && errno != ENOMEM && plain_integer |
| 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) | 219 | && XINT (zone) % (60 * 60) == 0) |
| 213 | { | 220 | { |
| 221 | /* tzalloc mishandles POSIX strings; fall back on tzdb if | ||
| 222 | possible (Bug#30738). */ | ||
| 214 | sprintf (tzbuf, "Etc/GMT%+"pI"d", - (XINT (zone) / (60 * 60))); | 223 | sprintf (tzbuf, "Etc/GMT%+"pI"d", - (XINT (zone) / (60 * 60))); |
| 215 | new_tz = tzalloc (zone_string); | 224 | new_tz = tzalloc (zone_string); |
| 216 | } | 225 | } |
| 217 | #endif | ||
| 218 | 226 | ||
| 219 | if (!new_tz) | 227 | if (!new_tz) |
| 220 | { | 228 | { |