diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-04-11 14:13:31 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-05-16 08:52:39 -0400 |
commit | 47b4913050a320bfba55fa65d52d9ba15488bc70 (patch) | |
tree | 7b97d0a03104a21e0df8911cda102113982632d5 /src/backend/replication | |
parent | 21c2c3d75e888a578176616aa1411552f43b4908 (diff) | |
download | postgresql-47b4913050a320bfba55fa65d52d9ba15488bc70.tar.gz postgresql-47b4913050a320bfba55fa65d52d9ba15488bc70.zip |
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.
Diffstat (limited to 'src/backend/replication')
-rw-r--r-- | src/backend/replication/basebackup.c | 4 | ||||
-rw-r--r-- | src/backend/replication/logical/reorderbuffer.c | 2 | ||||
-rw-r--r-- | src/backend/replication/logical/snapbuild.c | 4 | ||||
-rw-r--r-- | src/backend/replication/slot.c | 6 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c index 08d67332596..87a753787fd 100644 --- a/src/backend/replication/basebackup.c +++ b/src/backend/replication/basebackup.c @@ -888,7 +888,7 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces, { DIR *dir; struct dirent *de; - char pathbuf[MAXPGPATH]; + char pathbuf[MAXPGPATH * 2]; struct stat statbuf; int64 size = 0; @@ -940,7 +940,7 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces, "and should not be used. " "Try taking another online backup."))); - snprintf(pathbuf, MAXPGPATH, "%s/%s", path, de->d_name); + snprintf(pathbuf, sizeof(pathbuf), "%s/%s", path, de->d_name); /* Skip postmaster.pid and postmaster.opts in the data directory */ if (strcmp(pathbuf, "./postmaster.pid") == 0 || diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 10798aee443..72c70585bc5 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -2650,7 +2650,7 @@ StartupReorderBuffer(void) while ((logical_de = ReadDir(logical_dir, "pg_replslot")) != NULL) { struct stat statbuf; - char path[MAXPGPATH]; + char path[MAXPGPATH * 2 + 12]; if (strcmp(logical_de->d_name, ".") == 0 || strcmp(logical_de->d_name, "..") == 0) diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index 536f7620ced..43ec8e49439 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -1831,7 +1831,7 @@ CheckPointSnapBuild(void) XLogRecPtr redo; DIR *snap_dir; struct dirent *snap_de; - char path[MAXPGPATH]; + char path[MAXPGPATH + 21]; /* * We start of with a minimum of the last redo pointer. No new replication @@ -1858,7 +1858,7 @@ CheckPointSnapBuild(void) strcmp(snap_de->d_name, "..") == 0) continue; - snprintf(path, MAXPGPATH, "pg_logical/snapshots/%s", snap_de->d_name); + snprintf(path, sizeof(path), "pg_logical/snapshots/%s", snap_de->d_name); if (lstat(path, &statbuf) == 0 && !S_ISREG(statbuf.st_mode)) { diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index d64cfc6dc9e..ca0b8c65c6a 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -918,13 +918,13 @@ StartupReplicationSlots(void) while ((replication_de = ReadDir(replication_dir, "pg_replslot")) != NULL) { struct stat statbuf; - char path[MAXPGPATH]; + char path[MAXPGPATH + 12]; if (strcmp(replication_de->d_name, ".") == 0 || strcmp(replication_de->d_name, "..") == 0) continue; - snprintf(path, MAXPGPATH, "pg_replslot/%s", replication_de->d_name); + snprintf(path, sizeof(path), "pg_replslot/%s", replication_de->d_name); /* we're only creating directories here, skip if it's not our's */ if (lstat(path, &statbuf) == 0 && !S_ISDIR(statbuf.st_mode)) @@ -1148,7 +1148,7 @@ RestoreSlotFromDisk(const char *name) { ReplicationSlotOnDisk cp; int i; - char path[MAXPGPATH]; + char path[MAXPGPATH + 22]; int fd; bool restored = false; int readBytes; |