From a91830b783db3bb481930c67914d3c16b821f717 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 28 Oct 2022 22:55:10 -0700
Subject: [PROPOSED 1/3] Fix tzalloc bug on platforms lacking tm_zone
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Đoàn Trần Công Danh in:
https://mm.icann.org/pipermail/tz/2022-October/032153.html
* NEWS: Mention this.
* zdump.c (tzalloc) [!USE_LOCALTIME_RZ && HAVE_SETENV]:
Return a nonnull pointer.
---
 NEWS    | 8 ++++++++
 zdump.c | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 41b1304c..46c3fd4c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,13 @@
 News for the tz database
 
+Unreleased, experimental changes
+
+  Changes to code
+
+    Fix bug in zdump's tzalloc emulation on hosts like musl that lack
+    support for tm_zone.  (Problem reported by Đoàn Trần Công Danh.)
+
+
 Release 2022f - 2022-10-28 18:04:57 -0700
 
   Briefly:
diff --git a/zdump.c b/zdump.c
index ffb321a0..512ba8cc 100644
--- a/zdump.c
+++ b/zdump.c
@@ -234,7 +234,7 @@ tzalloc(char const *val)
     exit(EXIT_FAILURE);
   }
   tzset();
-  return NULL;
+  return &progname;  /* Any valid non-null char ** will do.  */
 # else
   enum { TZeqlen = 3 };
   static char const TZeq[TZeqlen] = "TZ=";
-- 
2.37.2

