Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5515c73

Browse filesBrowse 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 e15115b commit 5515c73
Copy full SHA for 5515c73

File tree

Expand file treeCollapse file tree

5 files changed

+80
-141
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+80
-141
lines changed

‎src/timezone/Makefile

Copy file name to clipboardExpand all lines: src/timezone/Makefile
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ zic: $(ZICOBJS) | submake-libpgport
5555

5656
install: all installdirs
5757
ifeq (,$(with_system_tzdata))
58-
$(ZIC) -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(ZIC_OPTIONS) $(TZDATAFILES)
58+
$(ZIC) -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' -b fat $(ZIC_OPTIONS) $(TZDATAFILES)
5959
endif
6060
$(MAKE) -C tznames $@
6161

‎src/timezone/README

Copy file name to clipboardExpand all lines: src/timezone/README
+1-1Lines 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

Copy file name to clipboardExpand all lines: src/timezone/strftime.c
+10Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.