diff options
Diffstat (limited to 'tools/idevicepair.c')
-rw-r--r-- | tools/idevicepair.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/tools/idevicepair.c b/tools/idevicepair.c index de631a0..68507f4 100644 --- a/tools/idevicepair.c +++ b/tools/idevicepair.c @@ -202,30 +202,25 @@ int main(int argc, char **argv) return EXIT_SUCCESS; } - if (udid) { - ret = idevice_new(&device, udid); - if (ret != IDEVICE_E_SUCCESS) { - printf("No device found with udid %s, is it plugged in?\n", udid); - free(udid); - return EXIT_FAILURE; + ret = idevice_new(&device, udid); + if (ret != IDEVICE_E_SUCCESS) { + if (udid) { + printf("No device found with udid %s.\n", udid); + } else { + printf("No device found.\n"); } free(udid); - udid = NULL; - } else { - ret = idevice_new(&device, NULL); + return EXIT_FAILURE; + } + if (!udid) { + ret = idevice_get_udid(device, &udid); if (ret != IDEVICE_E_SUCCESS) { - printf("No device found, is it plugged in?\n"); - return EXIT_FAILURE; + printf("ERROR: Could not get device udid, error code %d\n", ret); + result = EXIT_FAILURE; + goto leave; } } - ret = idevice_get_udid(device, &udid); - if (ret != IDEVICE_E_SUCCESS) { - printf("ERROR: Could not get device udid, error code %d\n", ret); - result = EXIT_FAILURE; - goto leave; - } - if (op == OP_HOSTID) { plist_t pair_record = NULL; char *hostid = NULL; @@ -244,7 +239,7 @@ int main(int argc, char **argv) return EXIT_SUCCESS; } - lerr = lockdownd_client_new(device, &client, "idevicepair"); + lerr = lockdownd_client_new(device, &client, TOOL_NAME); if (lerr != LOCKDOWN_E_SUCCESS) { idevice_free(device); printf("ERROR: Could not connect to lockdownd, error code %d\n", lerr); |