diff options
author | Alvaro Herrera | 2009-01-13 15:28:42 +0000 |
---|---|---|
committer | Alvaro Herrera | 2009-01-13 15:28:42 +0000 |
commit | b379d53c3055e14fc1cce5a09bc4b4c7471a884f (patch) | |
tree | 049d9f7a084eecffae9f8ecc15d53b032dab08eb | |
parent | e3a4d5cf8c0b4a88f94fb3b44ebc9f8e8e6d89fb (diff) |
Backpatch to 7.4 the part of 1.84 (from the 8.0 timeline) that wasn't already
patched, viz. str_numth(). The rest of that patch was already applied as part
of 1.69.2.1. Per report and patch from Andreas 'ads' Scherbaum.
The involved revisions were:
revision 1.84
date: 2005-01-12 22:40:13 -0300; author: tgl; state: Exp; lines: +9 -7;
branches: 1.84.4;
Remove unportable assumption that it's okay to use the target buffer
of an sprintf() as a source string. Demonstrably does not work with
recent gcc and/or glibc on some platforms.
and
revision 1.69.2.1
date: 2005-03-25 20:42:21 -0400; author: tgl; state: Exp; lines: +24 -8;
Prevent to_char(interval) from dumping core on month-related formats
when a zero-month interval is given. Per discussion with Karel.
-rw-r--r-- | src/backend/utils/adt/formatting.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index a4f420042c0..6955f0bad51 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- * formatting.c * - * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.69.2.2 2007/06/29 01:52:14 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v 1.69.2.3 2009/01/13 15:28:42 alvherre Exp $ * * * Portions Copyright (c) 1999-2003, PostgreSQL Global Development Group @@ -1444,7 +1444,9 @@ get_th(char *num, int type) static char * str_numth(char *dest, char *num, int type) { - sprintf(dest, "%s%s", num, get_th(num, type)); + if (dest != num) + strcpy(dest, num); + strcat(dest, get_th(num, type)); return dest; } @@ -2097,7 +2099,6 @@ dch_date(int arg, char *inout, int suf, int flag, FormatNode *node, void *data) switch (arg) { - case DCH_A_D: case DCH_B_C: if (flag == TO_CHAR) |