diff options
| author | 2023-02-11 00:26:22 +0100 | |
|---|---|---|
| committer | 2023-02-11 00:26:22 +0100 | |
| commit | 39701a4c3377603f826ad7fe61fbe27d6c126004 (patch) | |
| tree | d203aeada2ab435e257cd22a40e5431feac82b1f | |
| parent | 3909271599917bc4a3a996f99bdd3f88c49577fa (diff) | |
| download | ideviceinstaller-39701a4c3377603f826ad7fe61fbe27d6c126004.tar.gz ideviceinstaller-39701a4c3377603f826ad7fe61fbe27d6c126004.tar.bz2 | |
Make sure to always return an error code if something goes wrong
| -rw-r--r-- | src/ideviceinstaller.c | 77 |
1 files changed, 20 insertions, 57 deletions
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c index 2334199..69ccf29 100644 --- a/src/ideviceinstaller.c +++ b/src/ideviceinstaller.c | |||
| @@ -664,7 +664,7 @@ int main(int argc, char **argv) | |||
| 664 | np_client_t np = NULL; | 664 | np_client_t np = NULL; |
| 665 | afc_client_t afc = NULL; | 665 | afc_client_t afc = NULL; |
| 666 | lockdownd_service_descriptor_t service = NULL; | 666 | lockdownd_service_descriptor_t service = NULL; |
| 667 | int res = 0; | 667 | int res = EXIT_FAILURE; |
| 668 | char *bundleidentifier = NULL; | 668 | char *bundleidentifier = NULL; |
| 669 | 669 | ||
| 670 | #ifndef WIN32 | 670 | #ifndef WIN32 |
| @@ -681,26 +681,23 @@ int main(int argc, char **argv) | |||
| 681 | } else { | 681 | } else { |
| 682 | fprintf(stderr, "No device found.\n"); | 682 | fprintf(stderr, "No device found.\n"); |
| 683 | } | 683 | } |
| 684 | return -1; | 684 | return EXIT_FAILURE; |
| 685 | } | 685 | } |
| 686 | 686 | ||
| 687 | if (!udid) { | 687 | if (!udid) { |
| 688 | idevice_get_udid(device, &udid); | 688 | idevice_get_udid(device, &udid); |
| 689 | } | 689 | } |
| 690 | 690 | ||
| 691 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &client, "ideviceinstaller")) { | 691 | lockdownd_error_t lerr = lockdownd_client_new_with_handshake(device, &client, "ideviceinstaller"); |
| 692 | fprintf(stderr, "Could not connect to lockdownd. Exiting.\n"); | 692 | if (lerr != LOCKDOWN_E_SUCCESS) { |
| 693 | res = -1; | 693 | fprintf(stderr, "Could not connect to lockdownd: %s. Exiting.\n", lockdownd_strerror(lerr)); |
| 694 | goto leave_cleanup; | 694 | goto leave_cleanup; |
| 695 | } | 695 | } |
| 696 | 696 | ||
| 697 | if (use_notifier) { | 697 | if (use_notifier) { |
| 698 | if ((lockdownd_start_service | 698 | lerr =lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &service); |
| 699 | (client, "com.apple.mobile.notification_proxy", | 699 | if (lerr != LOCKDOWN_E_SUCCESS) { |
| 700 | &service) != LOCKDOWN_E_SUCCESS) || !service) { | 700 | fprintf(stderr, "Could not start com.apple.mobile.notification_proxy: %s\n", lockdownd_strerror(lerr)); |
| 701 | fprintf(stderr, | ||
| 702 | "Could not start com.apple.mobile.notification_proxy!\n"); | ||
| 703 | res = -1; | ||
| 704 | goto leave_cleanup; | 701 | goto leave_cleanup; |
| 705 | } | 702 | } |
| 706 | 703 | ||
| @@ -713,7 +710,6 @@ int main(int argc, char **argv) | |||
| 713 | 710 | ||
| 714 | if (nperr != NP_E_SUCCESS) { | 711 | if (nperr != NP_E_SUCCESS) { |
| 715 | fprintf(stderr, "Could not connect to notification_proxy!\n"); | 712 | fprintf(stderr, "Could not connect to notification_proxy!\n"); |
| 716 | res = -1; | ||
| 717 | goto leave_cleanup; | 713 | goto leave_cleanup; |
| 718 | } | 714 | } |
| 719 | 715 | ||
| @@ -730,11 +726,9 @@ run_again: | |||
| 730 | } | 726 | } |
| 731 | service = NULL; | 727 | service = NULL; |
| 732 | 728 | ||
| 733 | if ((lockdownd_start_service(client, "com.apple.mobile.installation_proxy", | 729 | lerr = lockdownd_start_service(client, "com.apple.mobile.installation_proxy", &service); |
| 734 | &service) != LOCKDOWN_E_SUCCESS) || !service) { | 730 | if (lerr != LOCKDOWN_E_SUCCESS) { |
| 735 | fprintf(stderr, | 731 | fprintf(stderr, "Could not start com.apple.mobile.installation_proxy: %s\n", lockdownd_strerror(lerr)); |
| 736 | "Could not start com.apple.mobile.installation_proxy!\n"); | ||
| 737 | res = -1; | ||
| 738 | goto leave_cleanup; | 732 | goto leave_cleanup; |
| 739 | } | 733 | } |
| 740 | 734 | ||
| @@ -747,7 +741,6 @@ run_again: | |||
| 747 | 741 | ||
| 748 | if (err != INSTPROXY_E_SUCCESS) { | 742 | if (err != INSTPROXY_E_SUCCESS) { |
| 749 | fprintf(stderr, "Could not connect to installation_proxy!\n"); | 743 | fprintf(stderr, "Could not connect to installation_proxy!\n"); |
| 750 | res = -1; | ||
| 751 | goto leave_cleanup; | 744 | goto leave_cleanup; |
| 752 | } | 745 | } |
| 753 | 746 | ||
| @@ -798,9 +791,7 @@ run_again: | |||
| 798 | err = instproxy_browse(ipc, client_opts, &apps); | 791 | err = instproxy_browse(ipc, client_opts, &apps); |
| 799 | 792 | ||
| 800 | if (!apps || (plist_get_node_type(apps) != PLIST_ARRAY)) { | 793 | if (!apps || (plist_get_node_type(apps) != PLIST_ARRAY)) { |
| 801 | fprintf(stderr, | 794 | fprintf(stderr, "ERROR: instproxy_browse returnd an invalid plist!\n"); |
| 802 | "ERROR: instproxy_browse returnd an invalid plist!\n"); | ||
| 803 | res = -1; | ||
| 804 | goto leave_cleanup; | 795 | goto leave_cleanup; |
| 805 | } | 796 | } |
| 806 | 797 | ||
| @@ -826,7 +817,6 @@ run_again: | |||
| 826 | instproxy_client_options_free(client_opts); | 817 | instproxy_client_options_free(client_opts); |
| 827 | if (err != INSTPROXY_E_SUCCESS) { | 818 | if (err != INSTPROXY_E_SUCCESS) { |
| 828 | fprintf(stderr, "ERROR: instproxy_browse returned %d\n", err); | 819 | fprintf(stderr, "ERROR: instproxy_browse returned %d\n", err); |
| 829 | res = -1; | ||
| 830 | goto leave_cleanup; | 820 | goto leave_cleanup; |
| 831 | } | 821 | } |
| 832 | 822 | ||
| @@ -843,10 +833,9 @@ run_again: | |||
| 843 | lockdownd_service_descriptor_free(service); | 833 | lockdownd_service_descriptor_free(service); |
| 844 | service = NULL; | 834 | service = NULL; |
| 845 | 835 | ||
| 846 | if ((lockdownd_start_service(client, "com.apple.afc", &service) != | 836 | lerr = lockdownd_start_service(client, "com.apple.afc", &service); |
| 847 | LOCKDOWN_E_SUCCESS) || !service) { | 837 | if (lerr != LOCKDOWN_E_SUCCESS) { |
| 848 | fprintf(stderr, "Could not start com.apple.afc!\n"); | 838 | fprintf(stderr, "Could not start com.apple.afc: %s\n", lockdownd_strerror(lerr)); |
| 849 | res = -1; | ||
| 850 | goto leave_cleanup; | 839 | goto leave_cleanup; |
| 851 | } | 840 | } |
| 852 | 841 | ||
| @@ -855,13 +844,11 @@ run_again: | |||
| 855 | 844 | ||
| 856 | if (afc_client_new(device, service, &afc) != AFC_E_SUCCESS) { | 845 | if (afc_client_new(device, service, &afc) != AFC_E_SUCCESS) { |
| 857 | fprintf(stderr, "Could not connect to AFC!\n"); | 846 | fprintf(stderr, "Could not connect to AFC!\n"); |
| 858 | res = -1; | ||
| 859 | goto leave_cleanup; | 847 | goto leave_cleanup; |
| 860 | } | 848 | } |
| 861 | 849 | ||
| 862 | if (stat(appid, &fst) != 0) { | 850 | if (stat(appid, &fst) != 0) { |
| 863 | fprintf(stderr, "ERROR: stat: %s: %s\n", appid, strerror(errno)); | 851 | fprintf(stderr, "ERROR: stat: %s: %s\n", appid, strerror(errno)); |
| 864 | res = -1; | ||
| 865 | goto leave_cleanup; | 852 | goto leave_cleanup; |
| 866 | } | 853 | } |
| 867 | 854 | ||
| @@ -890,7 +877,6 @@ run_again: | |||
| 890 | zf = zip_open(appid, 0, &errp); | 877 | zf = zip_open(appid, 0, &errp); |
| 891 | if (!zf) { | 878 | if (!zf) { |
| 892 | fprintf(stderr, "ERROR: zip_open: %s: %d\n", appid, errp); | 879 | fprintf(stderr, "ERROR: zip_open: %s: %d\n", appid, errp); |
| 893 | res = -1; | ||
| 894 | goto leave_cleanup; | 880 | goto leave_cleanup; |
| 895 | } | 881 | } |
| 896 | 882 | ||
| @@ -963,7 +949,6 @@ run_again: | |||
| 963 | afc_file_close(afc, af); | 949 | afc_file_close(afc, af); |
| 964 | zip_fclose(zfile); | 950 | zip_fclose(zfile); |
| 965 | free(dstpath); | 951 | free(dstpath); |
| 966 | res = -1; | ||
| 967 | goto leave_cleanup; | 952 | goto leave_cleanup; |
| 968 | } | 953 | } |
| 969 | } | 954 | } |
| @@ -987,7 +972,6 @@ run_again: | |||
| 987 | 972 | ||
| 988 | if (asprintf(&pkgname, "%s/%s", PKG_PATH, basename(appid)) < 0) { | 973 | if (asprintf(&pkgname, "%s/%s", PKG_PATH, basename(appid)) < 0) { |
| 989 | fprintf(stderr, "ERROR: Out of memory allocating pkgname!?\n"); | 974 | fprintf(stderr, "ERROR: Out of memory allocating pkgname!?\n"); |
| 990 | res = -1; | ||
| 991 | goto leave_cleanup; | 975 | goto leave_cleanup; |
| 992 | } | 976 | } |
| 993 | 977 | ||
| @@ -1008,7 +992,6 @@ run_again: | |||
| 1008 | if (stat(filename, &st) == -1 || (fp = fopen(filename, "r")) == NULL) { | 992 | if (stat(filename, &st) == -1 || (fp = fopen(filename, "r")) == NULL) { |
| 1009 | fprintf(stderr, "ERROR: could not locate %s in app!\n", filename); | 993 | fprintf(stderr, "ERROR: could not locate %s in app!\n", filename); |
| 1010 | free(filename); | 994 | free(filename); |
| 1011 | res = -1; | ||
| 1012 | goto leave_cleanup; | 995 | goto leave_cleanup; |
| 1013 | } | 996 | } |
| 1014 | size_t filesize = st.st_size; | 997 | size_t filesize = st.st_size; |
| @@ -1017,7 +1000,6 @@ run_again: | |||
| 1017 | if (amount != filesize) { | 1000 | if (amount != filesize) { |
| 1018 | fprintf(stderr, "ERROR: could not read %u bytes from %s\n", (uint32_t)filesize, filename); | 1001 | fprintf(stderr, "ERROR: could not read %u bytes from %s\n", (uint32_t)filesize, filename); |
| 1019 | free(filename); | 1002 | free(filename); |
| 1020 | res = -1; | ||
| 1021 | goto leave_cleanup; | 1003 | goto leave_cleanup; |
| 1022 | } | 1004 | } |
| 1023 | fclose(fp); | 1005 | fclose(fp); |
| @@ -1033,7 +1015,6 @@ run_again: | |||
| 1033 | 1015 | ||
| 1034 | if (!info) { | 1016 | if (!info) { |
| 1035 | fprintf(stderr, "ERROR: could not parse Info.plist!\n"); | 1017 | fprintf(stderr, "ERROR: could not parse Info.plist!\n"); |
| 1036 | res = -1; | ||
| 1037 | goto leave_cleanup; | 1018 | goto leave_cleanup; |
| 1038 | } | 1019 | } |
| 1039 | 1020 | ||
| @@ -1047,7 +1028,6 @@ run_again: | |||
| 1047 | zf = zip_open(appid, 0, &errp); | 1028 | zf = zip_open(appid, 0, &errp); |
| 1048 | if (!zf) { | 1029 | if (!zf) { |
| 1049 | fprintf(stderr, "ERROR: zip_open: %s: %d\n", appid, errp); | 1030 | fprintf(stderr, "ERROR: zip_open: %s: %d\n", appid, errp); |
| 1050 | res = -1; | ||
| 1051 | goto leave_cleanup; | 1031 | goto leave_cleanup; |
| 1052 | } | 1032 | } |
| 1053 | 1033 | ||
| @@ -1076,7 +1056,6 @@ run_again: | |||
| 1076 | 1056 | ||
| 1077 | if (zip_get_app_directory(zf, &app_directory_name)) { | 1057 | if (zip_get_app_directory(zf, &app_directory_name)) { |
| 1078 | fprintf(stderr, "Unable to locate app directory in archive!\n"); | 1058 | fprintf(stderr, "Unable to locate app directory in archive!\n"); |
| 1079 | res = -1; | ||
| 1080 | goto leave_cleanup; | 1059 | goto leave_cleanup; |
| 1081 | } | 1060 | } |
| 1082 | 1061 | ||
| @@ -1092,7 +1071,6 @@ run_again: | |||
| 1092 | free(filename); | 1071 | free(filename); |
| 1093 | zip_unchange_all(zf); | 1072 | zip_unchange_all(zf); |
| 1094 | zip_close(zf); | 1073 | zip_close(zf); |
| 1095 | res = -1; | ||
| 1096 | goto leave_cleanup; | 1074 | goto leave_cleanup; |
| 1097 | } | 1075 | } |
| 1098 | free(filename); | 1076 | free(filename); |
| @@ -1107,7 +1085,6 @@ run_again: | |||
| 1107 | fprintf(stderr, "Could not parse Info.plist!\n"); | 1085 | fprintf(stderr, "Could not parse Info.plist!\n"); |
| 1108 | zip_unchange_all(zf); | 1086 | zip_unchange_all(zf); |
| 1109 | zip_close(zf); | 1087 | zip_close(zf); |
| 1110 | res = -1; | ||
| 1111 | goto leave_cleanup; | 1088 | goto leave_cleanup; |
| 1112 | } | 1089 | } |
| 1113 | 1090 | ||
| @@ -1129,14 +1106,12 @@ run_again: | |||
| 1129 | fprintf(stderr, "Could not determine value for CFBundleExecutable!\n"); | 1106 | fprintf(stderr, "Could not determine value for CFBundleExecutable!\n"); |
| 1130 | zip_unchange_all(zf); | 1107 | zip_unchange_all(zf); |
| 1131 | zip_close(zf); | 1108 | zip_close(zf); |
| 1132 | res = -1; | ||
| 1133 | goto leave_cleanup; | 1109 | goto leave_cleanup; |
| 1134 | } | 1110 | } |
| 1135 | 1111 | ||
| 1136 | char *sinfname = NULL; | 1112 | char *sinfname = NULL; |
| 1137 | if (asprintf(&sinfname, "Payload/%s.app/SC_Info/%s.sinf", bundleexecutable, bundleexecutable) < 0) { | 1113 | if (asprintf(&sinfname, "Payload/%s.app/SC_Info/%s.sinf", bundleexecutable, bundleexecutable) < 0) { |
| 1138 | fprintf(stderr, "Out of memory!?\n"); | 1114 | fprintf(stderr, "Out of memory!?\n"); |
| 1139 | res = -1; | ||
| 1140 | goto leave_cleanup; | 1115 | goto leave_cleanup; |
| 1141 | } | 1116 | } |
| 1142 | free(bundleexecutable); | 1117 | free(bundleexecutable); |
| @@ -1156,13 +1131,13 @@ run_again: | |||
| 1156 | pkgname = NULL; | 1131 | pkgname = NULL; |
| 1157 | if (asprintf(&pkgname, "%s/%s", PKG_PATH, bundleidentifier) < 0) { | 1132 | if (asprintf(&pkgname, "%s/%s", PKG_PATH, bundleidentifier) < 0) { |
| 1158 | fprintf(stderr, "Out of memory!?\n"); | 1133 | fprintf(stderr, "Out of memory!?\n"); |
| 1159 | res = -1; | ||
| 1160 | goto leave_cleanup; | 1134 | goto leave_cleanup; |
| 1161 | } | 1135 | } |
| 1162 | 1136 | ||
| 1163 | printf("Copying '%s' to device... ", appid); | 1137 | printf("Copying '%s' to device... ", appid); |
| 1164 | 1138 | ||
| 1165 | if (afc_upload_file(afc, appid, pkgname) < 0) { | 1139 | if (afc_upload_file(afc, appid, pkgname) < 0) { |
| 1140 | printf("FAILED\n"); | ||
| 1166 | free(pkgname); | 1141 | free(pkgname); |
| 1167 | goto leave_cleanup; | 1142 | goto leave_cleanup; |
| 1168 | } | 1143 | } |
| @@ -1220,14 +1195,11 @@ run_again: | |||
| 1220 | err = instproxy_lookup_archives(ipc, NULL, &dict); | 1195 | err = instproxy_lookup_archives(ipc, NULL, &dict); |
| 1221 | if (err != INSTPROXY_E_SUCCESS) { | 1196 | if (err != INSTPROXY_E_SUCCESS) { |
| 1222 | fprintf(stderr, "ERROR: lookup_archives returned %d\n", err); | 1197 | fprintf(stderr, "ERROR: lookup_archives returned %d\n", err); |
| 1223 | res = -1; | ||
| 1224 | goto leave_cleanup; | 1198 | goto leave_cleanup; |
| 1225 | } | 1199 | } |
| 1226 | 1200 | ||
| 1227 | if (!dict) { | 1201 | if (!dict) { |
| 1228 | fprintf(stderr, | 1202 | fprintf(stderr, "ERROR: lookup_archives did not return a plist!?\n"); |
| 1229 | "ERROR: lookup_archives did not return a plist!?\n"); | ||
| 1230 | res = -1; | ||
| 1231 | goto leave_cleanup; | 1203 | goto leave_cleanup; |
| 1232 | } | 1204 | } |
| 1233 | 1205 | ||
| @@ -1333,14 +1305,12 @@ run_again: | |||
| 1333 | if (stat(copy_path, &fst) != 0) { | 1305 | if (stat(copy_path, &fst) != 0) { |
| 1334 | fprintf(stderr, "ERROR: stat: %s: %s\n", copy_path, strerror(errno)); | 1306 | fprintf(stderr, "ERROR: stat: %s: %s\n", copy_path, strerror(errno)); |
| 1335 | free(copy_path); | 1307 | free(copy_path); |
| 1336 | res = -1; | ||
| 1337 | goto leave_cleanup; | 1308 | goto leave_cleanup; |
| 1338 | } | 1309 | } |
| 1339 | 1310 | ||
| 1340 | if (!S_ISDIR(fst.st_mode)) { | 1311 | if (!S_ISDIR(fst.st_mode)) { |
| 1341 | fprintf(stderr, "ERROR: '%s' is not a directory as expected.\n", copy_path); | 1312 | fprintf(stderr, "ERROR: '%s' is not a directory as expected.\n", copy_path); |
| 1342 | free(copy_path); | 1313 | free(copy_path); |
| 1343 | res = -1; | ||
| 1344 | goto leave_cleanup; | 1314 | goto leave_cleanup; |
| 1345 | } | 1315 | } |
| 1346 | 1316 | ||
| @@ -1352,7 +1322,6 @@ run_again: | |||
| 1352 | if ((lockdownd_start_service(client, "com.apple.afc", &service) != LOCKDOWN_E_SUCCESS) || !service) { | 1322 | if ((lockdownd_start_service(client, "com.apple.afc", &service) != LOCKDOWN_E_SUCCESS) || !service) { |
| 1353 | fprintf(stderr, "Could not start com.apple.afc!\n"); | 1323 | fprintf(stderr, "Could not start com.apple.afc!\n"); |
| 1354 | free(copy_path); | 1324 | free(copy_path); |
| 1355 | res = -1; | ||
| 1356 | goto leave_cleanup; | 1325 | goto leave_cleanup; |
| 1357 | } | 1326 | } |
| 1358 | 1327 | ||
| @@ -1361,7 +1330,6 @@ run_again: | |||
| 1361 | 1330 | ||
| 1362 | if (afc_client_new(device, service, &afc) != AFC_E_SUCCESS) { | 1331 | if (afc_client_new(device, service, &afc) != AFC_E_SUCCESS) { |
| 1363 | fprintf(stderr, "Could not connect to AFC!\n"); | 1332 | fprintf(stderr, "Could not connect to AFC!\n"); |
| 1364 | res = -1; | ||
| 1365 | goto leave_cleanup; | 1333 | goto leave_cleanup; |
| 1366 | } | 1334 | } |
| 1367 | } | 1335 | } |
| @@ -1382,7 +1350,6 @@ run_again: | |||
| 1382 | if (err_occurred) { | 1350 | if (err_occurred) { |
| 1383 | afc_client_free(afc); | 1351 | afc_client_free(afc); |
| 1384 | afc = NULL; | 1352 | afc = NULL; |
| 1385 | res = -1; | ||
| 1386 | goto leave_cleanup; | 1353 | goto leave_cleanup; |
| 1387 | } | 1354 | } |
| 1388 | FILE *f = NULL; | 1355 | FILE *f = NULL; |
| @@ -1391,7 +1358,6 @@ run_again: | |||
| 1391 | char *localfile = NULL; | 1358 | char *localfile = NULL; |
| 1392 | if (asprintf(&localfile, "%s/%s.ipa", copy_path, appid) < 0) { | 1359 | if (asprintf(&localfile, "%s/%s.ipa", copy_path, appid) < 0) { |
| 1393 | fprintf(stderr, "Out of memory!?\n"); | 1360 | fprintf(stderr, "Out of memory!?\n"); |
| 1394 | res = -1; | ||
| 1395 | goto leave_cleanup; | 1361 | goto leave_cleanup; |
| 1396 | } | 1362 | } |
| 1397 | free(copy_path); | 1363 | free(copy_path); |
| @@ -1417,7 +1383,6 @@ run_again: | |||
| 1417 | fclose(f); | 1383 | fclose(f); |
| 1418 | free(remotefile); | 1384 | free(remotefile); |
| 1419 | free(localfile); | 1385 | free(localfile); |
| 1420 | res = -1; | ||
| 1421 | goto leave_cleanup; | 1386 | goto leave_cleanup; |
| 1422 | } | 1387 | } |
| 1423 | 1388 | ||
| @@ -1448,7 +1413,6 @@ run_again: | |||
| 1448 | fprintf(stderr, "ERROR: could not open '%s' on device for reading!\n", remotefile); | 1413 | fprintf(stderr, "ERROR: could not open '%s' on device for reading!\n", remotefile); |
| 1449 | free(remotefile); | 1414 | free(remotefile); |
| 1450 | free(localfile); | 1415 | free(localfile); |
| 1451 | res = -1; | ||
| 1452 | goto leave_cleanup; | 1416 | goto leave_cleanup; |
| 1453 | } | 1417 | } |
| 1454 | 1418 | ||
| @@ -1498,7 +1462,6 @@ run_again: | |||
| 1498 | options = NULL; | 1462 | options = NULL; |
| 1499 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &client, "ideviceinstaller")) { | 1463 | if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &client, "ideviceinstaller")) { |
| 1500 | fprintf(stderr, "Could not connect to lockdownd. Exiting.\n"); | 1464 | fprintf(stderr, "Could not connect to lockdownd. Exiting.\n"); |
| 1501 | res = -1; | ||
| 1502 | goto leave_cleanup; | 1465 | goto leave_cleanup; |
| 1503 | } | 1466 | } |
| 1504 | goto run_again; | 1467 | goto run_again; |
| @@ -1513,9 +1476,8 @@ run_again: | |||
| 1513 | instproxy_remove_archive(ipc, appid, NULL, status_cb, NULL); | 1476 | instproxy_remove_archive(ipc, appid, NULL, status_cb, NULL); |
| 1514 | wait_for_command_complete = 1; | 1477 | wait_for_command_complete = 1; |
| 1515 | } else { | 1478 | } else { |
| 1516 | printf | 1479 | printf("ERROR: no command selected?! This should not be reached!\n"); |
| 1517 | ("ERROR: no command selected?! This should not be reached!\n"); | 1480 | res = 2; |
| 1518 | res = -2; | ||
| 1519 | goto leave_cleanup; | 1481 | goto leave_cleanup; |
| 1520 | } | 1482 | } |
| 1521 | 1483 | ||
| @@ -1524,6 +1486,7 @@ run_again: | |||
| 1524 | client = NULL; | 1486 | client = NULL; |
| 1525 | 1487 | ||
| 1526 | idevice_wait_for_command_to_complete(); | 1488 | idevice_wait_for_command_to_complete(); |
| 1489 | res = 0; | ||
| 1527 | 1490 | ||
| 1528 | leave_cleanup: | 1491 | leave_cleanup: |
| 1529 | np_client_free(np); | 1492 | np_client_free(np); |
