aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/pg_rewind/libpq_fetch.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.c
index 710eca1c750..2c0c5723f79 100644
--- a/src/bin/pg_rewind/libpq_fetch.c
+++ b/src/bin/pg_rewind/libpq_fetch.c
@@ -220,13 +220,13 @@ libpqProcessFileList(void)
/* Read result to local variables */
for (i = 0; i < PQntuples(res); i++)
{
- char *path = PQgetvalue(res, i, 0);
- int64 filesize = atol(PQgetvalue(res, i, 1));
- bool isdir = (strcmp(PQgetvalue(res, i, 2), "t") == 0);
- char *link_target = PQgetvalue(res, i, 3);
+ char *path;
+ int64 filesize;
+ bool isdir;
+ char *link_target;
file_type_t type;
- if (PQgetisnull(res, 0, 1))
+ if (PQgetisnull(res, i, 1))
{
/*
* The file was removed from the server while the query was
@@ -235,6 +235,11 @@ libpqProcessFileList(void)
continue;
}
+ path = PQgetvalue(res, i, 0);
+ filesize = atol(PQgetvalue(res, i, 1));
+ isdir = (strcmp(PQgetvalue(res, i, 2), "t") == 0);
+ link_target = PQgetvalue(res, i, 3);
+
if (link_target[0])
type = FILE_TYPE_SYMLINK;
else if (isdir)