diff options
| author | 2011-04-26 15:09:53 +0200 | |
|---|---|---|
| committer | 2011-04-26 15:09:53 +0200 | |
| commit | e9b5eba30b3272361d846bc78b3bac6e9a8e2b40 (patch) | |
| tree | 5f7e13a5a8b8511d9faa23db06dac09b82284b13 /tools | |
| parent | d2a15c5f6f0bd9cfbd4fbfe3d5139f5ac6e85d94 (diff) | |
| download | libimobiledevice-e9b5eba30b3272361d846bc78b3bac6e9a8e2b40.tar.gz libimobiledevice-e9b5eba30b3272361d846bc78b3bac6e9a8e2b40.tar.bz2 | |
idevicebackup: Detect last file data hunk flag to prevent printing errors
We have interpreted code 0x0b as CODE_ERROR_REMOTE and printed this error
to the user which was disturbing. However, it is not an error but a flag which
signals the end of a series of data hunks being sent.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/idevicebackup4.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/idevicebackup4.c b/tools/idevicebackup4.c index 4235e08..d7adfc1 100644 --- a/tools/idevicebackup4.c +++ b/tools/idevicebackup4.c | |||
| @@ -697,6 +697,7 @@ static int mb2_handle_receive_files(plist_t message, const char *backup_dir) | |||
| 697 | char *fname = NULL; | 697 | char *fname = NULL; |
| 698 | gchar *bname = NULL; | 698 | gchar *bname = NULL; |
| 699 | char code = 0; | 699 | char code = 0; |
| 700 | char last_code = 0; | ||
| 700 | plist_t node = NULL; | 701 | plist_t node = NULL; |
| 701 | FILE *f = NULL; | 702 | FILE *f = NULL; |
| 702 | unsigned int file_count = 0; | 703 | unsigned int file_count = 0; |
| @@ -762,6 +763,7 @@ static int mb2_handle_receive_files(plist_t message, const char *backup_dir) | |||
| 762 | break; | 763 | break; |
| 763 | } | 764 | } |
| 764 | nlen = GUINT32_FROM_BE(nlen); | 765 | nlen = GUINT32_FROM_BE(nlen); |
| 766 | last_code = code; | ||
| 765 | code = 0; | 767 | code = 0; |
| 766 | mobilebackup2_receive_raw(mobilebackup2, &code, 1, &r); | 768 | mobilebackup2_receive_raw(mobilebackup2, &code, 1, &r); |
| 767 | if (r != 1) { | 769 | if (r != 1) { |
| @@ -805,6 +807,7 @@ static int mb2_handle_receive_files(plist_t message, const char *backup_dir) | |||
| 805 | mobilebackup2_receive_raw(mobilebackup2, (char*)&nlen, 4, &r); | 807 | mobilebackup2_receive_raw(mobilebackup2, (char*)&nlen, 4, &r); |
| 806 | nlen = GUINT32_FROM_BE(nlen); | 808 | nlen = GUINT32_FROM_BE(nlen); |
| 807 | if (nlen > 0) { | 809 | if (nlen > 0) { |
| 810 | last_code = code; | ||
| 808 | mobilebackup2_receive_raw(mobilebackup2, &code, 1, &r); | 811 | mobilebackup2_receive_raw(mobilebackup2, &code, 1, &r); |
| 809 | } else { | 812 | } else { |
| 810 | break; | 813 | break; |
| @@ -828,7 +831,10 @@ static int mb2_handle_receive_files(plist_t message, const char *backup_dir) | |||
| 828 | char *msg = (char*)malloc(nlen); | 831 | char *msg = (char*)malloc(nlen); |
| 829 | mobilebackup2_receive_raw(mobilebackup2, msg, nlen-1, &r); | 832 | mobilebackup2_receive_raw(mobilebackup2, msg, nlen-1, &r); |
| 830 | msg[r] = 0; | 833 | msg[r] = 0; |
| 831 | fprintf(stdout, "\nReceived an error message from device: %s\n", msg); | 834 | /* If sent using CODE_FILE_DATA, end marker will be CODE_ERROR_REMOTE which is not an error! */ |
| 835 | if (last_code != CODE_FILE_DATA) { | ||
| 836 | fprintf(stdout, "\nReceived an error message from device: %s\n", msg); | ||
| 837 | } | ||
| 832 | free(msg); | 838 | free(msg); |
| 833 | } | 839 | } |
| 834 | } while (1); | 840 | } while (1); |
