From 489a673aeeef4706af3986d41c24ab434e77d7d5 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Fri, 5 Jun 2020 20:50:34 +0200 Subject: tools: Unify --network command line switch and add it where missing --- tools/idevicepair.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'tools/idevicepair.c') 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); -- cgit v1.1-32-gdbae