summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-01-30 18:10:01 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2014-01-30 18:10:24 -0500
commit41e364ec67ec3a009574db9d20d1b85a654f95ae (patch)
tree86b8135c8173a8684368dea7092df67716da7d9a
parent760c770ff66b5c2f77f2e17750a2e263a74d82b3 (diff)
Fix potential coredump on bad locale value in pg_upgrade.
Thinko in error report (and a typo in the message text, too). We're failing anyway, but it would be good to print something useful first. Noted while reviewing a patch to make pg_upgrade's locale code laxer.
-rw-r--r--contrib/pg_upgrade/check.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/pg_upgrade/check.c b/contrib/pg_upgrade/check.c
index a706708f4d2..e395c7c7f62 100644
--- a/contrib/pg_upgrade/check.c
+++ b/contrib/pg_upgrade/check.c
@@ -990,6 +990,7 @@ get_canonical_locale_name(int category, const char *locale)
char *save;
char *res;
+ /* get the current setting, so we can restore it. */
save = setlocale(category, NULL);
if (!save)
pg_fatal("failed to get the current locale\n");
@@ -1001,7 +1002,7 @@ get_canonical_locale_name(int category, const char *locale)
res = setlocale(category, locale);
if (!res)
- pg_fatal("failed to get system local name for \"%s\"\n", res);
+ pg_fatal("failed to get system locale name for \"%s\"\n", locale);
res = pg_strdup(res);