Skip to content

Commit 7a46423

Browse files
committed
another fix for tablespace_map parsing
1 parent ac1e9a7 commit 7a46423

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/dir.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,12 +1150,22 @@ read_tablespace_map(parray *links, const char *backup_dir)
11501150
while (fgets(buf, lengthof(buf), fp))
11511151
{
11521152
char link_name[MAXPGPATH];
1153-
char path[MAXPGPATH];
1153+
char *path;
1154+
int n = 0;
11541155
pgFile *file;
1156+
int i = 0;
11551157

1156-
if (sscanf(buf, "%s %s", link_name, path) != 2)
1158+
if (sscanf(buf, "%s %n", link_name, &n) != 1)
11571159
elog(ERROR, "invalid format found in \"%s\"", map_path);
11581160

1161+
path = buf + n;
1162+
1163+
/* remove '\n' */
1164+
i = strlen(path) - 1;
1165+
path[i] = '\0';
1166+
1167+
elog(INFO, "STR: '%s'", path);
1168+
11591169
file = pgut_new(pgFile);
11601170
memset(file, 0, sizeof(pgFile));
11611171

0 commit comments

Comments
 (0)