From 7fc5615afdda0a1bae21c7d0fc47a376e7a8eda2 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/utils/time/snapmgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/backend/utils/time/snapmgr.c') diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c index 674cce2f781..a70605b0375 100644 --- a/src/backend/utils/time/snapmgr.c +++ b/src/backend/utils/time/snapmgr.c @@ -1313,7 +1313,7 @@ XactHasExportedSnapshots(void) void DeleteAllExportedSnapshotFiles(void) { - char buf[MAXPGPATH]; + char buf[MAXPGPATH + sizeof(SNAPSHOT_EXPORT_DIR)]; DIR *s_dir; struct dirent *s_de; @@ -1334,7 +1334,7 @@ DeleteAllExportedSnapshotFiles(void) strcmp(s_de->d_name, "..") == 0) continue; - snprintf(buf, MAXPGPATH, SNAPSHOT_EXPORT_DIR "/%s", s_de->d_name); + snprintf(buf, sizeof(buf), SNAPSHOT_EXPORT_DIR "/%s", s_de->d_name); /* Again, unlink failure is not worthy of FATAL */ if (unlink(buf)) elog(LOG, "could not unlink file \"%s\": %m", buf); -- cgit v1.2.3