1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Fix new warnings from GCC 7

This addresses the new warning types -Wformat-truncation
-Wformat-overflow that are part of -Wall, via -Wformat, in GCC 7.
This commit is contained in:
Peter Eisentraut
2017-04-11 14:13:31 -04:00
parent 0e8286d354
commit 6275f5d28a
23 changed files with 68 additions and 68 deletions

View File

@@ -1203,7 +1203,7 @@ CheckPointLogicalRewriteHeap(void)
XLogRecPtr redo;
DIR *mappings_dir;
struct dirent *mapping_de;
char path[MAXPGPATH];
char path[MAXPGPATH + 20];
/*
* We start of with a minimum of the last redo pointer. No new decoding
@@ -1234,7 +1234,7 @@ CheckPointLogicalRewriteHeap(void)
strcmp(mapping_de->d_name, "..") == 0)
continue;
snprintf(path, MAXPGPATH, "pg_logical/mappings/%s", mapping_de->d_name);
snprintf(path, sizeof(path), "pg_logical/mappings/%s", mapping_de->d_name);
if (lstat(path, &statbuf) == 0 && !S_ISREG(statbuf.st_mode))
continue;

View File

@@ -4102,7 +4102,7 @@ CleanupBackupHistory(void)
{
DIR *xldir;
struct dirent *xlde;
char path[MAXPGPATH];
char path[MAXPGPATH + sizeof(XLOGDIR)];
xldir = AllocateDir(XLOGDIR);
if (xldir == NULL)
@@ -4120,7 +4120,7 @@ CleanupBackupHistory(void)
ereport(DEBUG2,
(errmsg("removing transaction log backup history file \"%s\"",
xlde->d_name)));
snprintf(path, MAXPGPATH, XLOGDIR "/%s", xlde->d_name);
snprintf(path, sizeof(path), XLOGDIR "/%s", xlde->d_name);
unlink(path);
XLogArchiveCleanup(xlde->d_name);
}
@@ -10389,7 +10389,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
/* Collect information about all tablespaces */
while ((de = ReadDir(tblspcdir, "pg_tblspc")) != NULL)
{
char fullpath[MAXPGPATH];
char fullpath[MAXPGPATH + 10];
char linkpath[MAXPGPATH];
char *relpath = NULL;
int rllen;