diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/idevicebackup.c | 13 | ||||
-rw-r--r-- | tools/idevicebackup2.c | 28 | ||||
-rw-r--r-- | tools/idevicecrashreport.c | 6 | ||||
-rw-r--r-- | tools/ideviceprovision.c | 4 | ||||
-rw-r--r-- | tools/idevicesyslog.c | 22 |
5 files changed, 40 insertions, 33 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index 0affd7a..2856fda 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c | |||
@@ -926,15 +926,16 @@ int main(int argc, char *argv[]) | |||
926 | if (aerr == AFC_E_SUCCESS) { | 926 | if (aerr == AFC_E_SUCCESS) { |
927 | do_post_notification(NP_SYNC_DID_START); | 927 | do_post_notification(NP_SYNC_DID_START); |
928 | break; | 928 | break; |
929 | } else if (aerr == AFC_E_OP_WOULD_BLOCK) { | 929 | } |
930 | if (aerr == AFC_E_OP_WOULD_BLOCK) { | ||
930 | usleep(LOCK_WAIT); | 931 | usleep(LOCK_WAIT); |
931 | continue; | 932 | continue; |
932 | } else { | ||
933 | fprintf(stderr, "ERROR: could not lock file! error code: %d\n", aerr); | ||
934 | afc_file_close(afc, lockfile); | ||
935 | lockfile = 0; | ||
936 | cmd = CMD_LEAVE; | ||
937 | } | 933 | } |
934 | |||
935 | fprintf(stderr, "ERROR: could not lock file! error code: %d\n", aerr); | ||
936 | afc_file_close(afc, lockfile); | ||
937 | lockfile = 0; | ||
938 | cmd = CMD_LEAVE; | ||
938 | } | 939 | } |
939 | if (i == LOCK_ATTEMPTS) { | 940 | if (i == LOCK_ATTEMPTS) { |
940 | fprintf(stderr, "ERROR: timeout while locking for sync\n"); | 941 | fprintf(stderr, "ERROR: timeout while locking for sync\n"); |
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index d1ef0d6..ec7eacd 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
@@ -184,9 +184,8 @@ static int mkdir_with_parents(const char *dir, int mode) | |||
184 | if (!dir) return -1; | 184 | if (!dir) return -1; |
185 | if (__mkdir(dir, mode) == 0) { | 185 | if (__mkdir(dir, mode) == 0) { |
186 | return 0; | 186 | return 0; |
187 | } else { | ||
188 | if (errno == EEXIST) return 0; | ||
189 | } | 187 | } |
188 | if (errno == EEXIST) return 0; | ||
190 | int res; | 189 | int res; |
191 | char *parent = strdup(dir); | 190 | char *parent = strdup(dir); |
192 | char *parentdir = dirname(parent); | 191 | char *parentdir = dirname(parent); |
@@ -973,10 +972,12 @@ static int mb2_receive_filename(mobilebackup2_client_t mobilebackup2, char** fil | |||
973 | if ((nlen == 0) && (rlen == 4)) { | 972 | if ((nlen == 0) && (rlen == 4)) { |
974 | // a zero length means no more files to receive | 973 | // a zero length means no more files to receive |
975 | return 0; | 974 | return 0; |
976 | } else if(rlen == 0) { | 975 | } |
976 | if (rlen == 0) { | ||
977 | // device needs more time, waiting... | 977 | // device needs more time, waiting... |
978 | continue; | 978 | continue; |
979 | } else if (nlen > 4096) { | 979 | } |
980 | if (nlen > 4096) { | ||
980 | // filename length is too large | 981 | // filename length is too large |
981 | printf("ERROR: %s: too large filename length (%d)!\n", __func__, nlen); | 982 | printf("ERROR: %s: too large filename length (%d)!\n", __func__, nlen); |
982 | return 0; | 983 | return 0; |
@@ -1368,7 +1369,8 @@ static void get_hidden_input(char *buf, int maxlen) | |||
1368 | while ((c = my_getch())) { | 1369 | while ((c = my_getch())) { |
1369 | if ((c == '\r') || (c == '\n')) { | 1370 | if ((c == '\r') || (c == '\n')) { |
1370 | break; | 1371 | break; |
1371 | } else if (isprint(c)) { | 1372 | } |
1373 | if (isprint(c)) { | ||
1372 | if (pwlen < maxlen-1) | 1374 | if (pwlen < maxlen-1) |
1373 | buf[pwlen++] = c; | 1375 | buf[pwlen++] = c; |
1374 | fputc('*', stderr); | 1376 | fputc('*', stderr); |
@@ -1961,15 +1963,16 @@ int main(int argc, char *argv[]) | |||
1961 | if (aerr == AFC_E_SUCCESS) { | 1963 | if (aerr == AFC_E_SUCCESS) { |
1962 | do_post_notification(device, NP_SYNC_DID_START); | 1964 | do_post_notification(device, NP_SYNC_DID_START); |
1963 | break; | 1965 | break; |
1964 | } else if (aerr == AFC_E_OP_WOULD_BLOCK) { | 1966 | } |
1967 | if (aerr == AFC_E_OP_WOULD_BLOCK) { | ||
1965 | usleep(LOCK_WAIT); | 1968 | usleep(LOCK_WAIT); |
1966 | continue; | 1969 | continue; |
1967 | } else { | ||
1968 | fprintf(stderr, "ERROR: could not lock file! error code: %d\n", aerr); | ||
1969 | afc_file_close(afc, lockfile); | ||
1970 | lockfile = 0; | ||
1971 | cmd = CMD_LEAVE; | ||
1972 | } | 1970 | } |
1971 | |||
1972 | fprintf(stderr, "ERROR: could not lock file! error code: %d\n", aerr); | ||
1973 | afc_file_close(afc, lockfile); | ||
1974 | lockfile = 0; | ||
1975 | cmd = CMD_LEAVE; | ||
1973 | } | 1976 | } |
1974 | if (i == LOCK_ATTEMPTS) { | 1977 | if (i == LOCK_ATTEMPTS) { |
1975 | fprintf(stderr, "ERROR: timeout while locking for sync\n"); | 1978 | fprintf(stderr, "ERROR: timeout while locking for sync\n"); |
@@ -2103,9 +2106,8 @@ checkpoint: | |||
2103 | if (write_restore_applications(info_plist, afc) < 0) { | 2106 | if (write_restore_applications(info_plist, afc) < 0) { |
2104 | cmd = CMD_LEAVE; | 2107 | cmd = CMD_LEAVE; |
2105 | break; | 2108 | break; |
2106 | } else { | ||
2107 | PRINT_VERBOSE(1, "Wrote RestoreApplications.plist\n"); | ||
2108 | } | 2109 | } |
2110 | PRINT_VERBOSE(1, "Wrote RestoreApplications.plist\n"); | ||
2109 | } | 2111 | } |
2110 | 2112 | ||
2111 | /* Start restore */ | 2113 | /* Start restore */ |
diff --git a/tools/idevicecrashreport.c b/tools/idevicecrashreport.c index 48bda3a..d0d2147 100644 --- a/tools/idevicecrashreport.c +++ b/tools/idevicecrashreport.c | |||
@@ -475,10 +475,10 @@ int main(int argc, char* argv[]) | |||
475 | if (service_error == SERVICE_E_SUCCESS || service_error == SERVICE_E_TIMEOUT) { | 475 | if (service_error == SERVICE_E_SUCCESS || service_error == SERVICE_E_TIMEOUT) { |
476 | attempts++; | 476 | attempts++; |
477 | continue; | 477 | continue; |
478 | } else { | ||
479 | fprintf(stderr, "ERROR: Crash logs could not be moved. Connection interrupted (%d).\n", service_error); | ||
480 | break; | ||
481 | } | 478 | } |
479 | |||
480 | fprintf(stderr, "ERROR: Crash logs could not be moved. Connection interrupted (%d).\n", service_error); | ||
481 | break; | ||
482 | } | 482 | } |
483 | service_client_free(svcmove); | 483 | service_client_free(svcmove); |
484 | free(ping); | 484 | free(ping); |
diff --git a/tools/ideviceprovision.c b/tools/ideviceprovision.c index 981a7ee..7cd4f3f 100644 --- a/tools/ideviceprovision.c +++ b/tools/ideviceprovision.c | |||
@@ -448,7 +448,9 @@ int main(int argc, char *argv[]) | |||
448 | plist_free(pl); | 448 | plist_free(pl); |
449 | 449 | ||
450 | return res; | 450 | return res; |
451 | } else if (op == OP_COPY) { | 451 | } |
452 | |||
453 | if (op == OP_COPY) { | ||
452 | struct stat st; | 454 | struct stat st; |
453 | const char *checkdir = (param2) ? param2 : param; | 455 | const char *checkdir = (param2) ? param2 : param; |
454 | if ((stat(checkdir, &st) < 0) || !S_ISDIR(st.st_mode)) { | 456 | if ((stat(checkdir, &st) < 0) || !S_ISDIR(st.st_mode)) { |
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c index 2a72d72..f85c7cc 100644 --- a/tools/idevicesyslog.c +++ b/tools/idevicesyslog.c | |||
@@ -151,7 +151,9 @@ static void syslog_callback(char c, void *user_data) | |||
151 | shall_print = 1; | 151 | shall_print = 1; |
152 | cprintf(COLOR_WHITE); | 152 | cprintf(COLOR_WHITE); |
153 | break; | 153 | break; |
154 | } else if (line[3] == ' ' && line[6] == ' ' && line[15] == ' ') { | 154 | } |
155 | |||
156 | if (line[3] == ' ' && line[6] == ' ' && line[15] == ' ') { | ||
155 | char* end = &line[lp]; | 157 | char* end = &line[lp]; |
156 | char* p = &line[16]; | 158 | char* p = &line[16]; |
157 | 159 | ||
@@ -190,10 +192,9 @@ static void syslog_callback(char c, void *user_data) | |||
190 | if (!found) { | 192 | if (!found) { |
191 | shall_print = 0; | 193 | shall_print = 0; |
192 | break; | 194 | break; |
193 | } else { | ||
194 | triggered = 1; | ||
195 | shall_print = 1; | ||
196 | } | 195 | } |
196 | triggered = 1; | ||
197 | shall_print = 1; | ||
197 | } else if (num_trigger_filters == 0 && num_untrigger_filters > 0 && !triggered) { | 198 | } else if (num_trigger_filters == 0 && num_untrigger_filters > 0 && !triggered) { |
198 | shall_print = 0; | 199 | shall_print = 0; |
199 | quit_flag++; | 200 | quit_flag++; |
@@ -213,9 +214,8 @@ static void syslog_callback(char c, void *user_data) | |||
213 | if (!found) { | 214 | if (!found) { |
214 | shall_print = 0; | 215 | shall_print = 0; |
215 | break; | 216 | break; |
216 | } else { | ||
217 | shall_print = 1; | ||
218 | } | 217 | } |
218 | shall_print = 1; | ||
219 | } | 219 | } |
220 | 220 | ||
221 | /* process name */ | 221 | /* process name */ |
@@ -430,7 +430,8 @@ static void device_event_cb(const idevice_event_t* event, void* userdata) | |||
430 | { | 430 | { |
431 | if (use_network && event->conn_type != CONNECTION_NETWORK) { | 431 | if (use_network && event->conn_type != CONNECTION_NETWORK) { |
432 | return; | 432 | return; |
433 | } else if (!use_network && event->conn_type != CONNECTION_USBMUXD) { | 433 | } |
434 | if (!use_network && event->conn_type != CONNECTION_USBMUXD) { | ||
434 | return; | 435 | return; |
435 | } | 436 | } |
436 | if (event->event == IDEVICE_DEVICE_ADD) { | 437 | if (event->event == IDEVICE_DEVICE_ADD) { |
@@ -656,7 +657,8 @@ int main(int argc, char *argv[]) | |||
656 | fprintf(stderr, "ERROR: -p and -e/-q cannot be used together.\n"); | 657 | fprintf(stderr, "ERROR: -p and -e/-q cannot be used together.\n"); |
657 | print_usage(argc, argv, 1); | 658 | print_usage(argc, argv, 1); |
658 | return 2; | 659 | return 2; |
659 | } else if (include_filter > 0 && exclude_kernel > 0) { | 660 | } |
661 | if (include_filter > 0 && exclude_kernel > 0) { | ||
660 | fprintf(stderr, "ERROR: -p and -K cannot be used together.\n"); | 662 | fprintf(stderr, "ERROR: -p and -K cannot be used together.\n"); |
661 | print_usage(argc, argv, 1); | 663 | print_usage(argc, argv, 1); |
662 | return 2; | 664 | return 2; |
@@ -699,9 +701,9 @@ int main(int argc, char *argv[]) | |||
699 | if (!udid) { | 701 | if (!udid) { |
700 | fprintf(stderr, "No device found. Plug in a device or pass UDID with -u to wait for device to be available.\n"); | 702 | fprintf(stderr, "No device found. Plug in a device or pass UDID with -u to wait for device to be available.\n"); |
701 | return -1; | 703 | return -1; |
702 | } else { | ||
703 | fprintf(stderr, "Waiting for device with UDID %s to become available...\n", udid); | ||
704 | } | 704 | } |
705 | |||
706 | fprintf(stderr, "Waiting for device with UDID %s to become available...\n", udid); | ||
705 | } | 707 | } |
706 | 708 | ||
707 | line_buffer_size = 1024; | 709 | line_buffer_size = 1024; |