Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 59c341a

Browse files
committed
bugfix: duplicate returned by last_dir_separator() string for file->name
1 parent c4b49c6 commit 59c341a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/dir.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ pgFileInit(const char *path, const char *rel_path)
202202
canonicalize_path(file->rel_path);
203203

204204
/* Get file name from the path */
205-
file_name = last_dir_separator(file->path);
205+
file_name = pgut_strdup(last_dir_separator(file->path));
206+
206207
if (file_name == NULL)
207208
file->name = file->path;
208209
else
@@ -1675,14 +1676,14 @@ write_database_map(pgBackup *backup, parray *database_map, parray *backup_files_
16751676

16761677
fp = fio_fopen(database_map_path, PG_BINARY_W, FIO_BACKUP_HOST);
16771678
if (fp == NULL)
1678-
elog(ERROR, "Cannot open file list \"%s\": %s", path,
1679+
elog(ERROR, "Cannot open database map \"%s\": %s", path,
16791680
strerror(errno));
16801681

16811682
print_database_map(fp, database_map);
16821683
if (fio_fflush(fp) || fio_fclose(fp))
16831684
{
16841685
fio_unlink(database_map_path, FIO_BACKUP_HOST);
1685-
elog(ERROR, "Cannot write file list \"%s\": %s",
1686+
elog(ERROR, "Cannot write database map \"%s\": %s",
16861687
database_map_path, strerror(errno));
16871688
}
16881689

0 commit comments

Comments
 (0)