From dbcab8bca5b061c90b81ba87955cdb6421ad751b Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 26 Sep 2019 04:49:54 +0200 Subject: restore: Only use timeout error if it is actually defined --- configure.ac | 10 ++++++++++ src/restore.c | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/configure.ac b/configure.ac index 1d37315..73c3efd 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,16 @@ AC_CACHE_CHECK(for IDEVICE_E_TIMEOUT in enum idevice_error_t, ac_cv_idevice_erro if test "$ac_cv_idevice_error_has_timeout" = "yes"; then AC_DEFINE(HAVE_IDEVICE_E_TIMEOUT, 1, [Define if enum idevice_error_t defines IDEVICE_E_TIMEOUT]) fi +AC_CACHE_CHECK(for RESTORE_E_RECEIVE_TIMEOUT in enum restored_error_t, ac_cv_restored_error_has_timeout, + AC_TRY_COMPILE([ + #include + ], [ + return RESTORE_E_RECEIVE_TIMEOUT; + ], ac_cv_restored_error_has_timeout=yes, ac_cv_restored_error_has_timeout=no)) + +if test "$ac_cv_restored_error_has_timeout" = "yes"; then + AC_DEFINE(HAVE_RESTORE_E_RECEIVE_TIMEOUT, 1, [Define if enum restored_error_t defines RESTORE_E_RECEIVE_TIMEOUT]) +fi AC_SUBST(GLOBAL_CFLAGS) AC_SUBST(AC_LDFLAGS) diff --git a/src/restore.c b/src/restore.c index 1cc8b9a..0ea8a45 100644 --- a/src/restore.c +++ b/src/restore.c @@ -21,6 +21,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef HAVE_CONFIG_H +#include +#endif #include #include #include @@ -2790,6 +2793,7 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit } restore_error = restored_receive(restore, &message); +#ifdef HAVE_RESTORE_E_RECEIVE_TIMEOUT if (restore_error == RESTORE_E_RECEIVE_TIMEOUT) { debug("No data to read (timeout)\n"); message = NULL; @@ -2799,6 +2803,13 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit err = -11; break; } +#else + if (restore_error != RESTORE_E_SUCCESS) { + debug("No data to read\n"); + message = NULL; + continue; + } +#endif // discover what kind of message has been received node = plist_dict_get_item(message, "MsgType"); -- cgit v1.1-32-gdbae