Skip to content

Commit ce0e97f

Browse files
committed
Sync our copy of the timezone library with IANA release tzcode2020c.
This changes zic's default output format from "-b fat" to "-b slim". We were already using "slim" in v13/HEAD, so those branches drop the explicit -b switch in the Makefiles. Instead, add an explicit "-b fat" in v12 and before, so that we don't change the output file format in those branches. (This is perhaps excessively conservative, but we decided not to do so in a120791, and I'll stick with that.) Other non-cosmetic changes are to drop support for zic's long-obsolete "-y" switch, and to ensure that strftime() does not change errno unless it fails. As usual with tzcode changes, back-patch to all supported branches.
1 parent 02a75f8 commit ce0e97f

File tree

5 files changed

+80
-141
lines changed

5 files changed

+80
-141
lines changed

src/timezone/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ zic: $(ZICOBJS) | submake-libpgport
5656

5757
install: all installdirs
5858
ifeq (,$(with_system_tzdata))
59-
$(ZIC) -d '$(DESTDIR)$(datadir)/timezone' -b slim $(ZIC_OPTIONS) $(TZDATAFILES)
59+
$(ZIC) -d '$(DESTDIR)$(datadir)/timezone' $(ZIC_OPTIONS) $(TZDATAFILES)
6060
endif
6161
$(MAKE) -C tznames $@
6262

src/timezone/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ match properly on the old version.
5555
Time Zone code
5656
==============
5757

58-
The code in this directory is currently synced with tzcode release 2020a.
58+
The code in this directory is currently synced with tzcode release 2020c.
5959
There are many cosmetic (and not so cosmetic) differences from the
6060
original tzcode library, but diffs in the upstream version should usually
6161
be propagated to our version. Here are some notes about that.

src/timezone/strftime.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,22 @@ size_t
128128
pg_strftime(char *s, size_t maxsize, const char *format, const struct pg_tm *t)
129129
{
130130
char *p;
131+
int saved_errno = errno;
131132
enum warn warn = IN_NONE;
132133

133134
p = _fmt(format, t, s, s + maxsize, &warn);
135+
if (!p)
136+
{
137+
errno = EOVERFLOW;
138+
return 0;
139+
}
134140
if (p == s + maxsize)
141+
{
142+
errno = ERANGE;
135143
return 0;
144+
}
136145
*p = '\0';
146+
errno = saved_errno;
137147
return p - s;
138148
}
139149

0 commit comments

Comments
 (0)