Skip to content

Commit cef0652

Browse files
committed
Add defense against possibility that tzname[] doesn't exist.
1 parent dbd55d3 commit cef0652

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/backend/commands/variable.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.76 2003/05/18 01:06:25 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.77 2003/05/22 17:13:08 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -29,6 +29,17 @@
2929
#include "utils/tqual.h"
3030
#include "mb/pg_wchar.h"
3131

32+
/*
33+
* Some systems have tzname[] but don't declare it in <time.h>. Use this
34+
* to duplicate the test in AC_STRUCT_TIMEZONE.
35+
*/
36+
#ifdef HAVE_TZNAME
37+
#ifndef tzname /* For SGI. */
38+
extern char *tzname[];
39+
#endif
40+
#endif
41+
42+
3243
/*
3344
* DATESTYLE
3445
*/
@@ -325,8 +336,10 @@ tzset_succeeded(const char *tz)
325336
/*
326337
* Check first set of heuristics to say that tzset definitely worked.
327338
*/
339+
#ifdef HAVE_TZNAME
328340
if (tzname[1] && tzname[1][0] != '\0')
329341
return true;
342+
#endif
330343
if (TIMEZONE_GLOBAL != 0)
331344
return true;
332345

0 commit comments

Comments
 (0)