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/bin/pg_rewind/copy_fetch.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/bin/pg_rewind/copy_fetch.c') diff --git a/src/bin/pg_rewind/copy_fetch.c b/src/bin/pg_rewind/copy_fetch.c index 327e7ef5411..d7ce8ef2fcb 100644 --- a/src/bin/pg_rewind/copy_fetch.c +++ b/src/bin/pg_rewind/copy_fetch.c @@ -67,14 +67,14 @@ recurse_dir(const char *datadir, const char *parentpath, while (errno = 0, (xlde = readdir(xldir)) != NULL) { struct stat fst; - char fullpath[MAXPGPATH]; - char path[MAXPGPATH]; + char fullpath[MAXPGPATH * 2]; + char path[MAXPGPATH * 2]; if (strcmp(xlde->d_name, ".") == 0 || strcmp(xlde->d_name, "..") == 0) continue; - snprintf(fullpath, MAXPGPATH, "%s/%s", fullparentpath, xlde->d_name); + snprintf(fullpath, sizeof(fullpath), "%s/%s", fullparentpath, xlde->d_name); if (lstat(fullpath, &fst) < 0) { @@ -95,9 +95,9 @@ recurse_dir(const char *datadir, const char *parentpath, } if (parentpath) - snprintf(path, MAXPGPATH, "%s/%s", parentpath, xlde->d_name); + snprintf(path, sizeof(path), "%s/%s", parentpath, xlde->d_name); else - snprintf(path, MAXPGPATH, "%s", xlde->d_name); + snprintf(path, sizeof(path), "%s", xlde->d_name); if (S_ISREG(fst.st_mode)) callback(path, FILE_TYPE_REGULAR, fst.st_size, NULL); -- cgit v1.2.3