diff options
author | Nikias Bassen | 2019-07-12 18:45:46 +0700 |
---|---|---|
committer | Nikias Bassen | 2019-07-12 18:45:46 +0700 |
commit | 2332655423c1616d8e37ece7f33e98be0e218504 (patch) | |
tree | 8d83eb2aa8c6ed521b50d6242518ecb1d819726b | |
parent | 8510a9b290bc92993d2ae57a965b7f36325e1aa9 (diff) | |
download | libimobiledevice-2332655423c1616d8e37ece7f33e98be0e218504.tar.gz libimobiledevice-2332655423c1616d8e37ece7f33e98be0e218504.tar.bz2 |
Fix service startup in idevicecrashreport for iOS 13
-rw-r--r-- | tools/idevicecrashreport.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c index d0b2c7a..533265c 100644 --- a/tools/idevicecrashreport.c +++ b/tools/idevicecrashreport.c @@ -30,9 +30,10 @@ #include <unistd.h> #include "common/utils.h" -#include <libimobiledevice/afc.h> -#include <libimobiledevice/lockdown.h> #include <libimobiledevice/libimobiledevice.h> +#include <libimobiledevice/lockdown.h> +#include <libimobiledevice/service.h> +#include <libimobiledevice/afc.h> #include <plist/plist.h> #ifdef WIN32 @@ -55,7 +56,8 @@ static int file_exists(const char* path) #endif } -static int extract_raw_crash_report(const char* filename) { +static int extract_raw_crash_report(const char* filename) +{ int res = 0; plist_t report = NULL; char* raw = NULL; @@ -307,7 +309,8 @@ static void print_usage(int argc, char **argv) printf("Homepage: <" PACKAGE_URL ">\n"); } -int main(int argc, char* argv[]) { +int main(int argc, char* argv[]) +{ idevice_t device = NULL; lockdownd_client_t lockdownd = NULL; afc_client_t afc = NULL; @@ -396,9 +399,11 @@ int main(int argc, char* argv[]) { } /* trigger move operation on device */ - idevice_connection_t connection = NULL; - device_error = idevice_connect(device, service->port, &connection); - if(device_error != IDEVICE_E_SUCCESS) { + service_client_t svcmove = NULL; + service_error_t service_error = service_client_new(device, service, &svcmove); + lockdownd_service_descriptor_free(service); + service = NULL; + if (service_error != SERVICE_E_SUCCESS) { lockdownd_client_free(lockdownd); idevice_free(device); return -1; @@ -410,23 +415,18 @@ int main(int argc, char* argv[]) { int attempts = 0; while ((strncmp(ping, "ping", 4) != 0) && (attempts < 10)) { uint32_t bytes = 0; - device_error = idevice_connection_receive_timeout(connection, ping, 4, &bytes, 2000); - if (device_error != IDEVICE_E_SUCCESS) { + service_error = service_receive_with_timeout(svcmove, ping, 4, &bytes, 2000); + if (service_error == SERVICE_E_SUCCESS || service_error == SERVICE_E_TIMEOUT) { attempts++; continue; - } else if (device_error < 0) { - fprintf(stderr, "ERROR: Crash logs could not be moved. Connection interrupted.\n"); + } else { + fprintf(stderr, "ERROR: Crash logs could not be moved. Connection interrupted (%d).\n", service_error); break; } } - idevice_disconnect(connection); + service_client_free(svcmove); free(ping); - if (service) { - lockdownd_service_descriptor_free(service); - service = NULL; - } - if (device_error != IDEVICE_E_SUCCESS || attempts > 10) { fprintf(stderr, "ERROR: Failed to receive ping message from crash report mover.\n"); lockdownd_client_free(lockdownd); |