From 6a192b37b79ed7bcb6e2f620be02c3ea79c3601d Mon Sep 17 00:00:00 2001 From: Tianchen Zhang Date: Tue, 3 Feb 2026 12:26:54 +0800 Subject: [PATCH v2] Fix incorrect directory macro in KillExistingWALSummaries() There is a misuse of macro when we output directory information. Which should be `WALSUMMARYDIR` instead of `ARCHSTATDIR`. Since the macro `ARCHSTATDIR`, `WALSUMMARYDIR` and `WALSUMMARY_NHEXCHARS` are function-scoped, I add the undefine at the end of function KillExistingWALSummaries() and KillExistingArchiveStatus(). Now it won't lead to above mistake again. Author: Tianchen Zhang --- src/bin/pg_resetwal/pg_resetwal.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index 431b83a..85dc43d 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -1077,6 +1077,8 @@ KillExistingArchiveStatus(void) if (closedir(xldir)) pg_fatal("could not close directory \"%s\": %m", ARCHSTATDIR); + +#undef ARCHSTATDIR } /* @@ -1111,7 +1113,10 @@ KillExistingWALSummaries(void) pg_fatal("could not read directory \"%s\": %m", WALSUMMARYDIR); if (closedir(xldir)) - pg_fatal("could not close directory \"%s\": %m", ARCHSTATDIR); + pg_fatal("could not close directory \"%s\": %m", WALSUMMARYDIR); + +#undef WALSUMMARY_NHEXCHARS +#undef WALSUMMARYDIR } /* -- 2.39.3