aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/file/copydir.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-04-11 14:13:31 -0400
committerPeter Eisentraut <peter_e@gmx.net>2017-05-16 08:52:39 -0400
commit47b4913050a320bfba55fa65d52d9ba15488bc70 (patch)
tree7b97d0a03104a21e0df8911cda102113982632d5 /src/backend/storage/file/copydir.c
parent21c2c3d75e888a578176616aa1411552f43b4908 (diff)
downloadpostgresql-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/storage/file/copydir.c')
-rw-r--r--src/backend/storage/file/copydir.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/storage/file/copydir.c b/src/backend/storage/file/copydir.c
index a51ee815662..a964e47f502 100644
--- a/src/backend/storage/file/copydir.c
+++ b/src/backend/storage/file/copydir.c
@@ -38,8 +38,8 @@ copydir(char *fromdir, char *todir, bool recurse)
{
DIR *xldir;
struct dirent *xlde;
- char fromfile[MAXPGPATH];
- char tofile[MAXPGPATH];
+ char fromfile[MAXPGPATH * 2];
+ char tofile[MAXPGPATH * 2];
if (mkdir(todir, S_IRWXU) != 0)
ereport(ERROR,
@@ -63,8 +63,8 @@ copydir(char *fromdir, char *todir, bool recurse)
strcmp(xlde->d_name, "..") == 0)
continue;
- snprintf(fromfile, MAXPGPATH, "%s/%s", fromdir, xlde->d_name);
- snprintf(tofile, MAXPGPATH, "%s/%s", todir, xlde->d_name);
+ snprintf(fromfile, sizeof(fromfile), "%s/%s", fromdir, xlde->d_name);
+ snprintf(tofile, sizeof(tofile), "%s/%s", todir, xlde->d_name);
if (lstat(fromfile, &fst) < 0)
ereport(ERROR,
@@ -103,7 +103,7 @@ copydir(char *fromdir, char *todir, bool recurse)
strcmp(xlde->d_name, "..") == 0)
continue;
- snprintf(tofile, MAXPGPATH, "%s/%s", todir, xlde->d_name);
+ snprintf(tofile, sizeof(tofile), "%s/%s", todir, xlde->d_name);
/*
* We don't need to sync subdirectories here since the recursive