diff options
| -rw-r--r-- | tools/idevicebackup.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index a8b37d9..1eb12b0 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c | |||
| @@ -690,7 +690,7 @@ int main(int argc, char *argv[]) | |||
| 690 | node_tmp = plist_array_get_item(message, 2); | 690 | node_tmp = plist_array_get_item(message, 2); |
| 691 | 691 | ||
| 692 | /* first message hunk contains total backup size */ | 692 | /* first message hunk contains total backup size */ |
| 693 | if (hunk_index == 0) { | 693 | if ((hunk_index == 0) && (file_index == 0)) { |
| 694 | node = plist_dict_get_item(node_tmp, "BackupTotalSizeKey"); | 694 | node = plist_dict_get_item(node_tmp, "BackupTotalSizeKey"); |
| 695 | if (node) { | 695 | if (node) { |
| 696 | plist_get_uint_val(node, &backup_total_size); | 696 | plist_get_uint_val(node, &backup_total_size); |
| @@ -747,7 +747,7 @@ int main(int argc, char *argv[]) | |||
| 747 | filename_mdinfo = mobilebackup_build_path(backup_directory, file_path, ".mdinfo"); | 747 | filename_mdinfo = mobilebackup_build_path(backup_directory, file_path, ".mdinfo"); |
| 748 | 748 | ||
| 749 | /* remove any existing file */ | 749 | /* remove any existing file */ |
| 750 | if (stat(filename_mdinfo, &st) != 0) | 750 | if (stat(filename_mdinfo, &st) == 0) |
| 751 | remove(filename_mdinfo); | 751 | remove(filename_mdinfo); |
| 752 | 752 | ||
| 753 | node = plist_dict_get_item(node_tmp, "BackupFileInfo"); | 753 | node = plist_dict_get_item(node_tmp, "BackupFileInfo"); |
| @@ -768,7 +768,7 @@ int main(int argc, char *argv[]) | |||
| 768 | filename_mddata = mobilebackup_build_path(backup_directory, file_path, is_manifest ? NULL: ".mddata"); | 768 | filename_mddata = mobilebackup_build_path(backup_directory, file_path, is_manifest ? NULL: ".mddata"); |
| 769 | 769 | ||
| 770 | /* if this is the first hunk, remove any existing file */ | 770 | /* if this is the first hunk, remove any existing file */ |
| 771 | if (stat(filename_mddata, &st) != 0) | 771 | if ((hunk_index == 0) && (stat(filename_mddata, &st) == 0)) |
| 772 | remove(filename_mddata); | 772 | remove(filename_mddata); |
| 773 | 773 | ||
| 774 | /* get file data hunk */ | 774 | /* get file data hunk */ |
| @@ -803,6 +803,8 @@ int main(int argc, char *argv[]) | |||
| 803 | 803 | ||
| 804 | /* acknowlegdge that we received the file */ | 804 | /* acknowlegdge that we received the file */ |
| 805 | mobilebackup_send_backup_file_received(mobilebackup); | 805 | mobilebackup_send_backup_file_received(mobilebackup); |
| 806 | /* reset hunk_index */ | ||
| 807 | hunk_index = 0; | ||
| 806 | } | 808 | } |
| 807 | 809 | ||
| 808 | if (quit_flag > 0) { | 810 | if (quit_flag > 0) { |
