Skip to content

Commit 1ae3ab9

Browse files
danielgustafssonpull[bot]
authored andcommitted
Fix overridden callbacks in pg_rewind.
The <source>_traverse_files functions take a callback for processing files, but both the local and libpq source implementations called the function directly without using the callback argument. While there is no bug right now as the function called is the same as the callback, fix by calling the callback to reduce the risk of subtle bugs in the future. Author: Junwang Zhao <zhjwpku@gmail.com> Reviewed-by: Richard Guo <guofenglinux@gmail.com> Discussion: https://postgr.es/m/CAEG8a3Jdwgh+PZr2zh1=t8apA4Yz8tKq+uubPqoCt14nvWKHEw@mail.gmail.com
1 parent 36e7ba4 commit 1ae3ab9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/bin/pg_rewind/libpq_source.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ libpq_traverse_files(rewind_source *source, process_file_callback_t callback)
304304
else
305305
type = FILE_TYPE_REGULAR;
306306

307-
process_source_file(path, type, filesize, link_target);
307+
callback(path, type, filesize, link_target);
308308
}
309309
PQclear(res);
310310
}

src/bin/pg_rewind/local_source.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ init_local_source(const char *datadir)
5959
static void
6060
local_traverse_files(rewind_source *source, process_file_callback_t callback)
6161
{
62-
traverse_datadir(((local_source *) source)->datadir, &process_source_file);
62+
traverse_datadir(((local_source *) source)->datadir, callback);
6363
}
6464

6565
static char *

0 commit comments

Comments
 (0)