diff options
-rw-r--r-- | tools/iphonebackup.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/iphonebackup.c b/tools/iphonebackup.c index f0cfa7a..781f9d3 100644 --- a/tools/iphonebackup.c +++ b/tools/iphonebackup.c @@ -558,6 +558,7 @@ int main(int argc, char *argv[]) mobilebackup_send(mobilebackup, message); plist_free(message); message = NULL; + node = NULL; /* get response */ int backup_ok = 0; @@ -739,13 +740,21 @@ int main(int argc, char *argv[]) if (quit_flag > 0) { /* need to cancel the backup here */ mobilebackup_cancel_backup_with_error("Cancelling DLSendFile"); + + /* remove any atomic Manifest.plist.tmp */ + if (manifest_path) + g_free(manifest_path); + + manifest_path = mobilebackup_build_path(backup_directory, "Manifest", ".plist.tmp"); + if (stat(manifest_path, &st) == 0) + remove(manifest_path); break; } } while (1); printf("Received %d files from device.\n", file_index); - if (!plist_strcmp(node, "DLMessageProcessMessage")) { + if (!quit_flag && !plist_strcmp(node, "DLMessageProcessMessage")) { node_tmp = plist_array_get_item(message, 1); node = plist_dict_get_item(node_tmp, "BackupMessageTypeKey"); /* check if we received the final "backup finished" message */ @@ -791,9 +800,6 @@ int main(int argc, char *argv[]) if (manifest_path) g_free(manifest_path); - if (node) - plist_free(node); - break; case CMD_RESTORE: printf("Restoring backup is NOT IMPLEMENTED.\n"); |