1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Fix more format truncation issues

Fix the warnings created by the compiler warning options
-Wformat-overflow=2 -Wformat-truncation=2, supported since GCC 7.  This
is a more aggressive variant of the fixes in
6275f5d28a, which GCC 7 warned about by
default.

The issues are all harmless, but some dubious coding patterns are
cleaned up.

One issue that is of external interest is that BGW_MAXLEN is increased
from 64 to 96.  Apparently, the old value would cause the bgw_name of
logical replication workers to be truncated in some circumstances.

But this doesn't actually add those warning options.  It appears that
the warnings depend a bit on compilation and optimization options, so it
would be annoying to have to keep up with that.  This is more of a
once-in-a-while cleanup.

Reviewed-by: Michael Paquier <michael@paquier.xyz>
This commit is contained in:
Peter Eisentraut
2018-03-15 11:10:41 -04:00
parent 648a6c7bd8
commit 3a4b891964
14 changed files with 38 additions and 54 deletions

View File

@ -10528,7 +10528,7 @@ check_cluster_name(char **newval, void **extra, GucSource source)
static const char *
show_unix_socket_permissions(void)
{
static char buf[8];
static char buf[12];
snprintf(buf, sizeof(buf), "%04o", Unix_socket_permissions);
return buf;
@ -10537,7 +10537,7 @@ show_unix_socket_permissions(void)
static const char *
show_log_file_mode(void)
{
static char buf[8];
static char buf[12];
snprintf(buf, sizeof(buf), "%04o", Log_file_mode);
return buf;