From 0d00fbe0f84ee50f534c7b8b5809b3870e12769d Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 17 Jul 2012 18:55:58 +0200 Subject: restore: Always try to receive and handle possible StatusMsg on errors This does not directly exit if anything breaks but attempts to read one more message from restored which usually is a StatusMsg and contains information about the error that occoured. --- src/restore.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/restore.c b/src/restore.c index ca0e4e1..2280095 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1601,6 +1601,13 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit // this is the restore process loop, it reads each message in from // restored and passes that data on to it's specific handler while ((client->flags & FLAG_QUIT) == 0) { + // finally, if any of these message handlers returned -1 then we encountered + // an unrecoverable error, so we need to bail. + if (error < 0) { + error("ERROR: Unable to successfully restore device\n"); + client->flags |= FLAG_QUIT; + } + restore_error = restored_receive(restore, &message); if (restore_error != RESTORE_E_SUCCESS) { debug("No data to read\n"); @@ -1660,13 +1667,6 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit debug_plist(message); } - // finally, if any of these message handlers returned -1 then we encountered - // an unrecoverable error, so we need to bail. - if (error < 0) { - error("ERROR: Unable to successfully restore device\n"); - client->flags |= FLAG_QUIT; - } - plist_free(message); message = NULL; } -- cgit v1.1-32-gdbae