From e08b61eb2d9af499e3f154c6c1c37312cbd55a37 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Wed, 9 Jun 2010 02:08:09 +0200 Subject: idevicebackup: Fix broken backup due to closing down lockdown too early --- tools/idevicebackup.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'tools/idevicebackup.c') diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index 6626020..0994e47 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c @@ -857,12 +857,6 @@ int main(int argc, char *argv[]) } } - /* close down the lockdown connection as it is no longer needed */ - if (client) { - lockdownd_client_free(client); - client = NULL; - } - mobilebackup_error_t err; /* Manifest.plist (backup manifest (backup state)) */ @@ -902,6 +896,12 @@ int main(int argc, char *argv[]) plist_free(info_plist); info_plist = NULL; + /* close down the lockdown connection as it is no longer needed */ + if (client) { + lockdownd_client_free(client); + client = NULL; + } + /* create Status.plist with failed status for now */ mobilebackup_write_status(backup_directory, 0); @@ -1133,7 +1133,14 @@ int main(int argc, char *argv[]) } break; case CMD_RESTORE: + /* close down the lockdown connection as it is no longer needed */ + if (client) { + lockdownd_client_free(client); + client = NULL; + } + /* TODO: verify battery on AC enough battery remaining */ + /* verify if Status.plist says we read from an successful backup */ if (mobilebackup_read_status(backup_directory) <= 0) { printf("ERROR: Cannot ensure we restore from a successful backup. Aborting.\n"); @@ -1287,8 +1294,6 @@ int main(int argc, char *argv[]) if (err != MOBILEBACKUP_E_SUCCESS) { printf("ERROR: Could not send BackupMessageRestoreComplete, error code %d\n", err); } - /* TODO: close down notification_proxy connection */ - client = NULL; break; case CMD_LEAVE: default: -- cgit v1.1-32-gdbae