summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2010-07-21 16:20:50 +0200
committerGravatar Martin Szulecki2010-10-04 00:26:46 +0200
commitbc56e24ba14eaa60f55ffe9c748237ef2c79e142 (patch)
tree9fd351d20ddab8d72c91c90acbe231c0d80400de
parent6a870b945c6c1062553d7a14334fcbd392c44c1b (diff)
downloadlibimobiledevice-bc56e24ba14eaa60f55ffe9c748237ef2c79e142.tar.gz
libimobiledevice-bc56e24ba14eaa60f55ffe9c748237ef2c79e142.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.
-rw-r--r--tools/idevicebackup.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index 1eb12b0..1119bc0 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <signal.h>
#include <glib.h>
+#include <unistd.h>
#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
@@ -681,6 +682,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 */