Skip to content

Commit

Permalink
fixing bug where futurerestore would segfault if device doesn't recon…
Browse files Browse the repository at this point in the history
…nect fast enough
  • Loading branch information
tihmstar committed Feb 2, 2017
1 parent 6aa188c commit b35d3e1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion futurerestore/futurerestore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

1 comment on commit b35d3e1

@brymonster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tihmstar @nikias
anyway to get a compiled version of this branch?
i have been struggling with this for a while..

Please sign in to comment.