From b35d3e1245da49950028d753b1bdb40fce5d21d5 Mon Sep 17 00:00:00 2001 From: tihmstar Date: Thu, 2 Feb 2017 08:43:00 +0100 Subject: [PATCH] fixing bug where futurerestore would segfault if device doesn't reconnect fast enough --- futurerestore/futurerestore.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/futurerestore/futurerestore.cpp b/futurerestore/futurerestore.cpp index da3ac0c4f..e60aaed1e 100644 --- a/futurerestore/futurerestore.cpp +++ b/futurerestore/futurerestore.cpp @@ -491,13 +491,17 @@ int futurerestore::doRestore(const char *ipsw, bool noerase){ if (recovery_send_ibec(client, build_identity) < 0) { reterror(-8,"ERROR: Unable to send iBEC\n"); } + printf("waiting for device to reconnect... "); recovery_client_free(client); /* this must be long enough to allow the device to run the iBEC */ /* FIXME: Probably better to detect if the device is back then */ sleep(7); + for (int i=0;getDeviceMode(true) != MODE_RECOVERY && i<40; i++) putchar('.'),usleep(USEC_PER_SEC*0.5); + putchar('\n'); - check_mode(client); + if (!check_mode(client)) + reterror(-15, "failed to reconnect to device in recovery (iBEC) mode\n"); //do magic get_sep_nonce(client, &client->sepnonce, &client->sepnonce_size);