diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-08-04 19:29:25 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-08-04 19:29:25 +0000 |
commit | 4fd8d6b3e77eb00cfd7bb8d3d130b147ba0d60f3 (patch) | |
tree | e8fa7630964d3439c12aa3667ace88e318de074b /src/timezone/localtime.c | |
parent | 0b9d3d4dcd0561fbf674e09af1160f087eda535b (diff) |
Fix crash caused by log_timezone patch if we attempt to emit any elog messages
between the setting of log_line_prefix and the setting of log_timezone. We
can't realistically set log_timezone any earlier than we do now, so the best
behavior seems to be to use GMT zone if any timestamps are to be logged during
early startup. Create a dummy zone variable with a minimal definition of GMT
(in particular it will never know about leap seconds), so that we can set it
up without reference to any external files.
Diffstat (limited to 'src/timezone/localtime.c')
-rw-r--r-- | src/timezone/localtime.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c index fca5ebac643..774d83a2f6f 100644 --- a/src/timezone/localtime.c +++ b/src/timezone/localtime.c @@ -3,7 +3,7 @@ * 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). * * IDENTIFICATION - * $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.16 2006/10/18 16:43:14 tgl Exp $ + * $PostgreSQL: pgsql/src/timezone/localtime.c,v 1.17 2007/08/04 19:29:25 tgl Exp $ */ /* @@ -88,7 +88,6 @@ static void timesub(const pg_time_t *timep, long offset, const struct state * sp, struct pg_tm * tmp); static pg_time_t transtime(pg_time_t janfirst, int year, const struct rule * rulep, long offset); -int tzparse(const char *name, struct state * sp, int lastditch); /* GMT timezone */ static struct state gmtmem; @@ -549,6 +548,12 @@ tzparse(const char *name, struct state * sp, int lastditch) if (stdlen >= sizeof sp->chars) stdlen = (sizeof sp->chars) - 1; stdoffset = 0; + /* + * Unlike the original zic library, do NOT invoke tzload() here; + * we can't assume pg_open_tzfile() is sane yet, and we don't + * care about leap seconds anyway. + */ + load_result = -1; } else { @@ -561,8 +566,8 @@ tzparse(const char *name, struct state * sp, int lastditch) name = getoffset(name, &stdoffset); if (name == NULL) return -1; + load_result = tzload(TZDEFRULES, NULL, sp); } - load_result = tzload(TZDEFRULES, NULL, sp); if (load_result != 0) sp->leapcnt = 0; /* so, we're off a little */ if (*name != '\0') |