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:42 -0400 |
commit | 7fc5615afdda0a1bae21c7d0fc47a376e7a8eda2 (patch) | |
tree | 6fd23fc7ee61f18ac91ce4edaa3738bfac02ee57 /src/bin/pg_resetxlog/pg_resetxlog.c | |
parent | 2dca50b764d40c8cf4edeaaaf09a3292aeb7026e (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 1a0f350f994..ab1e13b9130 100644 --- a/src/bin/pg_resetxlog/pg_resetxlog.c +++ b/src/bin/pg_resetxlog/pg_resetxlog.c @@ -892,7 +892,7 @@ KillExistingXLOG(void) { DIR *xldir; struct dirent *xlde; - char path[MAXPGPATH]; + char path[MAXPGPATH + sizeof(XLOGDIR)]; xldir = opendir(XLOGDIR); if (xldir == NULL) @@ -907,7 +907,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"), @@ -939,11 +939,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) @@ -959,7 +959,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"), |