@@ -587,14 +587,11 @@ push_file_internal_uncompressed(const char *wal_file_name, const char *pg_xlog_d
587587thread_num ,from_fullpath ,strerror (errno ));
588588}
589589
590- if (read_len > 0 )
590+ if (read_len > 0 && fio_write ( out , buf , read_len ) != read_len )
591591{
592- if (fio_write (out ,buf ,read_len )!= read_len )
593- {
594- fio_unlink (to_fullpath_part ,FIO_BACKUP_HOST );
595- elog (ERROR ,"Thread [%d]: Cannot write to destination temp file \"%s\": %s" ,
596- thread_num ,to_fullpath_part ,strerror (errno ));
597- }
592+ fio_unlink (to_fullpath_part ,FIO_BACKUP_HOST );
593+ elog (ERROR ,"Thread [%d]: Cannot write to destination temp file \"%s\": %s" ,
594+ thread_num ,to_fullpath_part ,strerror (errno ));
598595}
599596
600597if (feof (in ))
@@ -832,14 +829,11 @@ push_file_internal_gz(const char *wal_file_name, const char *pg_xlog_dir,
832829thread_num ,from_fullpath ,strerror (errno ));
833830}
834831
835- if (read_len > 0 )
832+ if (read_len > 0 && fio_gzwrite ( out , buf , read_len ) != read_len )
836833{
837- if (fio_gzwrite (out ,buf ,read_len )!= read_len )
838- {
839- fio_unlink (to_fullpath_gz_part ,FIO_BACKUP_HOST );
840- elog (ERROR ,"Thread [%d]: Cannot write to compressed temp WAL file \"%s\": %s" ,
841- thread_num ,to_fullpath_gz_part ,get_gz_error (out ,errno ));
842- }
834+ fio_unlink (to_fullpath_gz_part ,FIO_BACKUP_HOST );
835+ elog (ERROR ,"Thread [%d]: Cannot write to compressed temp WAL file \"%s\": %s" ,
836+ thread_num ,to_fullpath_gz_part ,get_gz_error (out ,errno ));
843837}
844838
845839if (feof (in ))