diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2017-04-11 14:13:31 -0400 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2017-05-15 13:31:38 -0400 |
commit | 80a06b5acda386edcb48a98188d9bfdd7a338a4e (patch) | |
tree | 7b19ef8310b373bcc9047d42be93d0a903574cea /src/bin/pg_resetxlog/pg_resetxlog.c | |
parent | 2c80c3710fd9bc98e06d65006bc89a8024430745 (diff) |
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/bin/pg_resetxlog/pg_resetxlog.c')
-rw-r--r-- | src/bin/pg_resetxlog/pg_resetxlog.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bin/pg_resetxlog/pg_resetxlog.c b/src/bin/pg_resetxlog/pg_resetxlog.c index 8a066b46012..cc6b2540a89 100644 --- a/src/bin/pg_resetxlog/pg_resetxlog.c +++ b/src/bin/pg_resetxlog/pg_resetxlog.c @@ -836,7 +836,7 @@ KillExistingXLOG(void) { DIR *xldir; struct dirent *xlde; - char path[MAXPGPATH]; + char path[MAXPGPATH + sizeof(XLOGDIR)]; xldir = opendir(XLOGDIR); if (xldir == NULL) @@ -851,7 +851,7 @@ KillExistingXLOG(void) if (strlen(xlde->d_name) == 24 && strspn(xlde->d_name, "0123456789ABCDEF") == 24) { - snprintf(path, MAXPGPATH, "%s/%s", XLOGDIR, xlde->d_name); + snprintf(path, sizeof(path), "%s/%s", XLOGDIR, xlde->d_name); if (unlink(path) < 0) { fprintf(stderr, _("%s: could not delete file \"%s\": %s\n"), @@ -889,11 +889,11 @@ KillExistingXLOG(void) static void KillExistingArchiveStatus(void) { +#define ARCHSTATDIR XLOGDIR "/archive_status" + DIR *xldir; struct dirent *xlde; - char path[MAXPGPATH]; - -#define ARCHSTATDIR XLOGDIR "/archive_status" + char path[MAXPGPATH + sizeof(ARCHSTATDIR)]; xldir = opendir(ARCHSTATDIR); if (xldir == NULL) @@ -909,7 +909,7 @@ KillExistingArchiveStatus(void) (strcmp(xlde->d_name + 24, ".ready") == 0 || strcmp(xlde->d_name + 24, ".done") == 0)) { - snprintf(path, MAXPGPATH, "%s/%s", ARCHSTATDIR, xlde->d_name); + snprintf(path, sizeof(path), "%s/%s", ARCHSTATDIR, xlde->d_name); if (unlink(path) < 0) { fprintf(stderr, _("%s: could not delete file \"%s\": %s\n"), |