@@ -1006,14 +1006,6 @@ backup_cleanup(bool fatal, void *userdata)
10061006{
10071007char path [MAXPGPATH ];
10081008
1009- /* If backup_label exists in $PGDATA, notify stop of backup to PostgreSQL */
1010- join_path_components (path ,pgdata ,PG_BACKUP_LABEL_FILE );
1011- if (fileExists (path ))
1012- {
1013- elog (LOG ,"%s exists, stop backup" ,PG_BACKUP_LABEL_FILE );
1014- pg_stop_backup (NULL );/* don't care stop_lsn on error case */
1015- }
1016-
10171009/*
10181010 * Update status of backup in BACKUP_CONTROL_FILE to ERROR.
10191011 * end_time != 0 means backup finished
@@ -1025,6 +1017,17 @@ backup_cleanup(bool fatal, void *userdata)
10251017current .status = BACKUP_STATUS_ERROR ;
10261018pgBackupWriteBackupControlFile (& current );
10271019}
1020+
1021+ /*
1022+ * If backup_label exists in $PGDATA, notify stop of backup to PostgreSQL
1023+ * TODO Do we need this?
1024+ */
1025+ join_path_components (path ,pgdata ,PG_BACKUP_LABEL_FILE );
1026+ if (fileExists (path ))
1027+ {
1028+ elog (LOG ,"%s exists, stop backup" ,PG_BACKUP_LABEL_FILE );
1029+ pg_stop_backup (NULL );/* don't care stop_lsn on error case */
1030+ }
10281031}
10291032
10301033/*