From 47b4913050a320bfba55fa65d52d9ba15488bc70 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 11 Apr 2017 14:13:31 -0400 Subject: 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. --- src/backend/storage/file/copydir.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/backend/storage/file/copydir.c') 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 -- cgit v1.2.3