mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +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:
@@ -959,7 +959,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;
|
||||
|
||||
@@ -1011,7 +1011,7 @@ sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces,
|
||||
if (excludeFound)
|
||||
continue;
|
||||
|
||||
snprintf(pathbuf, MAXPGPATH, "%s/%s", path, de->d_name);
|
||||
snprintf(pathbuf, sizeof(pathbuf), "%s/%s", path, de->d_name);
|
||||
|
||||
/* Skip pg_control here to back up it last */
|
||||
if (strcmp(pathbuf, "./global/pg_control") == 0)
|
||||
|
||||
@@ -2613,7 +2613,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)
|
||||
|
||||
@@ -1868,7 +1868,7 @@ CheckPointSnapBuild(void)
|
||||
XLogRecPtr redo;
|
||||
DIR *snap_dir;
|
||||
struct dirent *snap_de;
|
||||
char path[MAXPGPATH];
|
||||
char path[MAXPGPATH + 21];
|
||||
|
||||
/*
|
||||
* We start off with a minimum of the last redo pointer. No new replication
|
||||
@@ -1895,7 +1895,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))
|
||||
{
|
||||
|
||||
@@ -1023,13 +1023,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))
|
||||
@@ -1259,7 +1259,7 @@ RestoreSlotFromDisk(const char *name)
|
||||
{
|
||||
ReplicationSlotOnDisk cp;
|
||||
int i;
|
||||
char path[MAXPGPATH];
|
||||
char path[MAXPGPATH + 22];
|
||||
int fd;
|
||||
bool restored = false;
|
||||
int readBytes;
|
||||
|
||||
Reference in New Issue
Block a user