diff options
author | Martin Szulecki | 2012-07-17 18:55:58 +0200 |
---|---|---|
committer | Nikias Bassen | 2012-07-17 18:55:58 +0200 |
commit | 0d00fbe0f84ee50f534c7b8b5809b3870e12769d (patch) | |
tree | c05bdf56c1ccf9436912624cb17b8529176fc68a /src | |
parent | ae3719ec5878c5fa23a2cddec1aac07b74ddb429 (diff) | |
download | idevicerestore-0d00fbe0f84ee50f534c7b8b5809b3870e12769d.tar.gz idevicerestore-0d00fbe0f84ee50f534c7b8b5809b3870e12769d.tar.bz2 |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/restore.c | 14 |
1 files 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; } |