From 7aed1ff56096ebaa7497241b8744f9c7387042f3 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 26 Jan 2010 03:05:37 +0100 Subject: Remove any temporary manifest if backup is aborted in iphonebackup --- tools/iphonebackup.c | 14 ++++++++++---- 1 file 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"); -- cgit v1.1-32-gdbae