summaryrefslogtreecommitdiffstats
path: root/tools/idevicebackup2.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/idevicebackup2.c')
-rw-r--r--tools/idevicebackup2.c28
1 files changed, 15 insertions, 13 deletions
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 */