@@ -219,17 +219,19 @@ read_backup(time_t timestamp)
219
219
/*
220
220
* Save the backup status into BACKUP_CONTROL_FILE.
221
221
*
222
- * We need to reread the backup using its ID and save it changing only its status.
222
+ * We need to reread the backup using its ID and save it changing only its
223
+ * status.
223
224
*/
224
225
void
225
226
write_backup_status (pgBackup * backup )
226
227
{
227
228
pgBackup * tmp ;
228
229
229
230
tmp = read_backup (backup -> start_time );
230
- tmp -> status = backup -> status ;
231
231
232
+ tmp -> status = backup -> status ;
232
233
write_backup (tmp );
234
+
233
235
pgBackupFree (tmp );
234
236
}
235
237
@@ -443,7 +445,8 @@ pgBackupWriteControl(FILE *out, pgBackup *backup)
443
445
fprintf (out , "block-size = %u\n" , backup -> block_size );
444
446
fprintf (out , "xlog-block-size = %u\n" , backup -> wal_block_size );
445
447
fprintf (out , "checksum-version = %u\n" , backup -> checksum_version );
446
- fprintf (out , "program-version = %s\n" , PROGRAM_VERSION );
448
+ if (backup -> program_version [0 ] != '\0' )
449
+ fprintf (out , "program-version = %s\n" , backup -> program_version );
447
450
if (backup -> server_version [0 ] != '\0' )
448
451
fprintf (out , "server-version = %s\n" , backup -> server_version );
449
452
@@ -493,17 +496,19 @@ pgBackupWriteControl(FILE *out, pgBackup *backup)
493
496
fprintf (out , "primary_conninfo = '%s'\n" , backup -> primary_conninfo );
494
497
}
495
498
496
- /* create BACKUP_CONTROL_FILE */
499
+ /*
500
+ * Save the backup content into BACKUP_CONTROL_FILE.
501
+ */
497
502
void
498
503
write_backup (pgBackup * backup )
499
504
{
500
505
FILE * fp = NULL ;
501
- char ini_path [MAXPGPATH ];
506
+ char conf_path [MAXPGPATH ];
502
507
503
- pgBackupGetPath (backup , ini_path , lengthof (ini_path ), BACKUP_CONTROL_FILE );
504
- fp = fopen (ini_path , "wt" );
508
+ pgBackupGetPath (backup , conf_path , lengthof (conf_path ), BACKUP_CONTROL_FILE );
509
+ fp = fopen (conf_path , "wt" );
505
510
if (fp == NULL )
506
- elog (ERROR , "cannot open configuration file \"%s\": %s" , ini_path ,
511
+ elog (ERROR , "Cannot open configuration file \"%s\": %s" , conf_path ,
507
512
strerror (errno ));
508
513
509
514
pgBackupWriteControl (fp , backup );
0 commit comments