summaryrefslogtreecommitdiffstats
path: root/tools/idevicebackup.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-07-21 16:20:50 +0200
committerGravatar Martin Szulecki2010-07-21 16:20:50 +0200
commit930ad759419712e6dd939953ef4a1f0c5a655086 (patch)
treed33fa6e361265e45d38878845c37a328c636d678 /tools/idevicebackup.c
parentaa25d87ae9b166919cf2ac273e673ac35333accc (diff)
downloadlibimobiledevice-930ad759419712e6dd939953ef4a1f0c5a655086.tar.gz
libimobiledevice-930ad759419712e6dd939953ef4a1f0c5a655086.tar.bz2
idevicebackup: Give the device time to prepare backup data
This change requests the initial backup files more gracefully as the device might need more time to prepare the backup data for bigger backups. Otherwise we cause a crash by attempting to parse a plist message we did not receive yet when the device is busy.
Diffstat (limited to 'tools/idevicebackup.c')
-rw-r--r--tools/idevicebackup.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index b9fb81a..c5c5b37 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -27,6 +27,7 @@
#include <signal.h>
#include <glib.h>
#include <gcrypt.h>
+#include <unistd.h>
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
@@ -946,6 +947,12 @@ int main(int argc, char *argv[])
/* process series of DLSendFile messages */
do {
mobilebackup_receive(mobilebackup, &message);
+ if (!message) {
+ printf("Device is not ready yet. Going to try again in 2 seconds...\n");
+ sleep(2);
+ continue;
+ }
+
node = plist_array_get_item(message, 0);
/* get out if we don't get a DLSendFile */