From cef0652a3d88baeca25459902657c94c1e360682 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Thu, 22 May 2003 17:13:08 +0000
Subject: [PATCH] Add defense against possibility that tzname[] doesn't exist.

---
 src/backend/commands/variable.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index aa8d9d36134..77fd47bee97 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.76 2003/05/18 01:06:25 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.77 2003/05/22 17:13:08 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -29,6 +29,17 @@
 #include "utils/tqual.h"
 #include "mb/pg_wchar.h"
 
+/*
+ * Some systems have tzname[] but don't declare it in <time.h>.  Use this
+ * to duplicate the test in AC_STRUCT_TIMEZONE.
+ */
+#ifdef HAVE_TZNAME
+#ifndef tzname /* For SGI.  */
+extern char *tzname[];
+#endif
+#endif
+
+
 /*
  * DATESTYLE
  */
@@ -325,8 +336,10 @@ tzset_succeeded(const char *tz)
 	/*
 	 * Check first set of heuristics to say that tzset definitely worked.
 	 */
+#ifdef HAVE_TZNAME
 	if (tzname[1] && tzname[1][0] != '\0')
 		return true;
+#endif
 	if (TIMEZONE_GLOBAL != 0)
 		return true;
 
-- 
GitLab