summaryrefslogtreecommitdiffstats
path: root/tools/idevicepair.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevicepair.c')
-rw-r--r--tools/idevicepair.c33
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)
202 return EXIT_SUCCESS; 202 return EXIT_SUCCESS;
203 } 203 }
204 204
205 if (udid) { 205 ret = idevice_new(&device, udid);
206 ret = idevice_new(&device, udid); 206 if (ret != IDEVICE_E_SUCCESS) {
207 if (ret != IDEVICE_E_SUCCESS) { 207 if (udid) {
208 printf("No device found with udid %s, is it plugged in?\n", udid); 208 printf("No device found with udid %s.\n", udid);
209 free(udid); 209 } else {
210 return EXIT_FAILURE; 210 printf("No device found.\n");
211 } 211 }
212 free(udid); 212 free(udid);
213 udid = NULL; 213 return EXIT_FAILURE;
214 } else { 214 }
215 ret = idevice_new(&device, NULL); 215 if (!udid) {
216 ret = idevice_get_udid(device, &udid);
216 if (ret != IDEVICE_E_SUCCESS) { 217 if (ret != IDEVICE_E_SUCCESS) {
217 printf("No device found, is it plugged in?\n"); 218 printf("ERROR: Could not get device udid, error code %d\n", ret);
218 return EXIT_FAILURE; 219 result = EXIT_FAILURE;
220 goto leave;
219 } 221 }
220 } 222 }
221 223
222 ret = idevice_get_udid(device, &udid);
223 if (ret != IDEVICE_E_SUCCESS) {
224 printf("ERROR: Could not get device udid, error code %d\n", ret);
225 result = EXIT_FAILURE;
226 goto leave;
227 }
228
229 if (op == OP_HOSTID) { 224 if (op == OP_HOSTID) {
230 plist_t pair_record = NULL; 225 plist_t pair_record = NULL;
231 char *hostid = NULL; 226 char *hostid = NULL;
@@ -244,7 +239,7 @@ int main(int argc, char **argv)
244 return EXIT_SUCCESS; 239 return EXIT_SUCCESS;
245 } 240 }
246 241
247 lerr = lockdownd_client_new(device, &client, "idevicepair"); 242 lerr = lockdownd_client_new(device, &client, TOOL_NAME);
248 if (lerr != LOCKDOWN_E_SUCCESS) { 243 if (lerr != LOCKDOWN_E_SUCCESS) {
249 idevice_free(device); 244 idevice_free(device);
250 printf("ERROR: Could not connect to lockdownd, error code %d\n", lerr); 245 printf("ERROR: Could not connect to lockdownd, error code %d\n", lerr);