diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c index f7f3b8227fd..53110e0f4bf 100644 --- a/src/bin/pg_rewind/pg_rewind.c +++ b/src/bin/pg_rewind/pg_rewind.c @@ -873,6 +873,7 @@ getTimelineHistory(TimeLineID tli, bool is_source, int *nentries) pg_free(histfile); } + /* In debugging mode, print what we read */ if (debug) { int i; @@ -882,10 +883,7 @@ getTimelineHistory(TimeLineID tli, bool is_source, int *nentries) else pg_log_debug("Target timeline history:"); - /* - * Print the target timeline history. - */ - for (i = 0; i < targetNentries; i++) + for (i = 0; i < *nentries; i++) { TimeLineHistoryEntry *entry;