aboutsummaryrefslogtreecommitdiff
path: root/src/bin/pg_resetxlog/pg_resetxlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/pg_resetxlog/pg_resetxlog.c')
-rw-r--r--src/bin/pg_resetxlog/pg_resetxlog.c12
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 013c26bd6d2..3ffff22daab 100644
--- a/src/bin/pg_resetxlog/pg_resetxlog.c
+++ b/src/bin/pg_resetxlog/pg_resetxlog.c
@@ -963,7 +963,7 @@ KillExistingXLOG(void)
{
DIR *xldir;
struct dirent *xlde;
- char path[MAXPGPATH];
+ char path[MAXPGPATH + sizeof(XLOGDIR)];
xldir = opendir(XLOGDIR);
if (xldir == NULL)
@@ -978,7 +978,7 @@ KillExistingXLOG(void)
if (IsXLogFileName(xlde->d_name) ||
IsPartialXLogFileName(xlde->d_name))
{
- 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"),
@@ -1010,11 +1010,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)
@@ -1032,7 +1032,7 @@ KillExistingArchiveStatus(void)
strcmp(xlde->d_name + XLOG_FNAME_LEN, ".partial.ready") == 0 ||
strcmp(xlde->d_name + XLOG_FNAME_LEN, ".partial.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"),