summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-01-26 03:05:37 +0100
committerGravatar Martin Szulecki2010-01-26 03:05:37 +0100
commit7aed1ff56096ebaa7497241b8744f9c7387042f3 (patch)
tree86030c6d095b8a3515c97fb8a69a4f0e97933251
parent135a69205083b8b499147eb8f34baf586e76bb49 (diff)
downloadlibimobiledevice-7aed1ff56096ebaa7497241b8744f9c7387042f3.tar.gz
libimobiledevice-7aed1ff56096ebaa7497241b8744f9c7387042f3.tar.bz2
Remove any temporary manifest if backup is aborted in iphonebackup
-rw-r--r--tools/iphonebackup.c14
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");