summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-12-26 15:30:10 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2018-12-26 15:30:40 -0500
commit4f7ab73106a0782fde22f7f405ef36954cb40eb5 (patch)
treec2c5a7e398a47af39d373b0621b27360167ece7e /src
parentb7b0314b80e90130b27e9f5ee4e45778e4cccf09 (diff)
Fix portability failure introduced in commits d2b0b60e7 et al.
I made a frontend fprintf() format use %m, forgetting that that's only safe in HEAD not the back branches; prior to 96bf88d52 and d6c55de1f, it would work on glibc platforms but not elsewhere. Revert to using %s ... strerror(errno) as the code did before. We could have left HEAD as-is, but for code consistency across branches, I chose to apply this patch there too. Per Coverity and a few buildfarm members.
Diffstat (limited to 'src')
-rw-r--r--src/common/psprintf.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/common/psprintf.c b/src/common/psprintf.c
index b736d7895ca..c5ce4b72230 100644
--- a/src/common/psprintf.c
+++ b/src/common/psprintf.c
@@ -131,7 +131,8 @@ pvsnprintf(char *buf, size_t len, const char *fmt, va_list args)
#ifndef FRONTEND
elog(ERROR, "vsnprintf failed: %m with format string \"%s\"", fmt);
#else
- fprintf(stderr, "vsnprintf failed: %m with format string \"%s\"\n", fmt);
+ fprintf(stderr, "vsnprintf failed: %s with format string \"%s\"\n",
+ strerror(errno), fmt);
exit(EXIT_FAILURE);
#endif
}