From 7a464232ed5c03a2b560d1bd53c487c23151b634 Mon Sep 17 00:00:00 2001 From: Grigory Smolkin Date: Thu, 15 Apr 2021 16:01:17 +0300 Subject: [PATCH] another fix for tablespace_map parsing --- src/dir.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/dir.c b/src/dir.c index ef23f684..bd91c108 100644 --- a/src/dir.c +++ b/src/dir.c @@ -1150,12 +1150,22 @@ read_tablespace_map(parray *links, const char *backup_dir) while (fgets(buf, lengthof(buf), fp)) { char link_name[MAXPGPATH]; - char path[MAXPGPATH]; + char *path; + int n = 0; pgFile *file; + int i = 0; - if (sscanf(buf, "%s %s", link_name, path) != 2) + if (sscanf(buf, "%s %n", link_name, &n) != 1) elog(ERROR, "invalid format found in \"%s\"", map_path); + path = buf + n; + + /* remove '\n' */ + i = strlen(path) - 1; + path[i] = '\0'; + + elog(INFO, "STR: '%s'", path); + file = pgut_new(pgFile); memset(file, 0, sizeof(pgFile));