1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-01-08 13:44:32 +02:00

another fix for tablespace_map parsing

This commit is contained in:
Grigory Smolkin 2021-04-15 16:01:17 +03:00
parent ac1e9a7da9
commit 7a464232ed

View File

@ -1150,12 +1150,22 @@ read_tablespace_map(parray *links, const char *backup_dir)
while (fgets(buf, lengthof(buf), fp)) while (fgets(buf, lengthof(buf), fp))
{ {
char link_name[MAXPGPATH]; char link_name[MAXPGPATH];
char path[MAXPGPATH]; char *path;
int n = 0;
pgFile *file; 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); 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); file = pgut_new(pgFile);
memset(file, 0, sizeof(pgFile)); memset(file, 0, sizeof(pgFile));