diff options
author | 2020-06-27 20:51:04 +0800 | |
---|---|---|
committer | 2022-04-22 12:10:52 +0200 | |
commit | 4a77478c13b35e311922d05f0866adce817a0d6a (patch) | |
tree | fe805d3be6598e3e476a9651e5671ddf0c519cbc /src | |
parent | 1f625b2e89b27c391a8c2f4aa9a82630f10abb92 (diff) | |
download | libimobiledevice-4a77478c13b35e311922d05f0866adce817a0d6a.tar.gz libimobiledevice-4a77478c13b35e311922d05f0866adce817a0d6a.tar.bz2 |
idevice: Fix mistreatment of 0-byte sent cases
Currently if 0 byte gets sent, it is treated as not-enough-data.
This is wrong, because with TCP, 0-byte-sent usually means the
receiver end is closed. We must set a new case for this and must
not normalize the sent-bytes to 0 in general.
Diffstat (limited to 'src')
-rw-r--r-- | src/idevice.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/idevice.c b/src/idevice.c index d6c1d06..f64570b 100644 --- a/src/idevice.c +++ b/src/idevice.c | |||
@@ -650,7 +650,10 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_send(idevice_connection_ | |||
650 | } | 650 | } |
651 | debug_info("len %d, sent %d", len, sent); | 651 | debug_info("len %d, sent %d", len, sent); |
652 | if (sent < len) { | 652 | if (sent < len) { |
653 | *sent_bytes = 0; | 653 | *sent_bytes = sent; |
654 | if (sent == 0) { | ||
655 | return IDEVICE_E_UNKNOWN_ERROR; | ||
656 | } | ||
654 | return IDEVICE_E_NOT_ENOUGH_DATA; | 657 | return IDEVICE_E_NOT_ENOUGH_DATA; |
655 | } | 658 | } |
656 | *sent_bytes = sent; | 659 | *sent_bytes = sent; |