Rename the TablespaceDataListCell element "f" to "fptr" for clarity

And add a few more comments to make it clearer what's going on.
This commit is contained in:
Ian Barwick
2020-06-09 14:06:12 +09:00
parent c1428a3ecd
commit db1cb1433f

View File

@@ -36,8 +36,8 @@ typedef struct TablespaceDataListCell
char *name; char *name;
char *oid; char *oid;
char *location; char *location;
/* optional payload */ /* Optional pointer to a file containing a list of tablespace files to copy from Barman */
FILE *f; FILE *fptr;
} TablespaceDataListCell; } TablespaceDataListCell;
typedef struct TablespaceDataList typedef struct TablespaceDataList
@@ -7027,17 +7027,17 @@ run_file_backup(t_node_info *local_node_record)
{ {
if ((q = string_skip_prefix(cell_t->oid, p)) != NULL && *q == '/') if ((q = string_skip_prefix(cell_t->oid, p)) != NULL && *q == '/')
{ {
if (cell_t->f == NULL) if (cell_t->fptr == NULL)
{ {
maxlen_snprintf(filename, "%s/%s.txt", local_repmgr_tmp_directory, cell_t->oid); maxlen_snprintf(filename, "%s/%s.txt", local_repmgr_tmp_directory, cell_t->oid);
cell_t->f = fopen(filename, "w"); cell_t->fptr = fopen(filename, "w");
if (cell_t->f == NULL) if (cell_t->fptr == NULL)
{ {
log_error("cannot open file: %s", filename); log_error("cannot open file: %s", filename);
exit(ERR_INTERNAL); exit(ERR_INTERNAL);
} }
} }
fputs(q + 1, cell_t->f); fputs(q + 1, cell_t->fptr);
break; break;
} }
} }
@@ -7179,10 +7179,11 @@ run_file_backup(t_node_info *local_node_record)
{ {
create_pg_dir(tblspc_dir_dest, false); create_pg_dir(tblspc_dir_dest, false);
if (cell_t->f != NULL) /* cell_t->f == NULL iff the tablespace is if (cell_t->fptr != NULL) /* cell_t->fptr == NULL iff the tablespace is
* empty */ * empty */
{ {
fclose(cell_t->f); /* close the file to ensure the contents are flushed to disk */
fclose(cell_t->fptr);
maxlen_snprintf(command, maxlen_snprintf(command,
"rsync --progress -a --files-from=%s/%s.txt %s:%s/%s/%s %s", "rsync --progress -a --files-from=%s/%s.txt %s:%s/%s/%s %s",
@@ -7193,8 +7194,7 @@ run_file_backup(t_node_info *local_node_record)
backup_id, backup_id,
cell_t->oid, cell_t->oid,
tblspc_dir_dest); tblspc_dir_dest);
(void) local_command( (void) local_command(command,
command,
NULL); NULL);
maxlen_snprintf(filename, maxlen_snprintf(filename,
"%s/%s.txt", "%s/%s.txt",