summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Geoff Paul2012-01-12 01:33:17 +0100
committerGravatar Nikias Bassen2012-01-12 01:33:17 +0100
commitc182599c8c18ed729726ea7cbbd0a3b89790d2db (patch)
treeb1d5c257d1de1f67528cb8457aa766d0af6caad1 /src
parentbe74df913206d354988db302eb049ed1e40a4a43 (diff)
downloadlibimobiledevice-c182599c8c18ed729726ea7cbbd0a3b89790d2db.tar.gz
libimobiledevice-c182599c8c18ed729726ea7cbbd0a3b89790d2db.tar.bz2
idevice: add error checking to internal_ssl_write()
Returning 0 bytes sent upon error causes an infinite loop within the calling gnutls code. Returning -1 as an error code allows gnutls to properly detect and recover.
Diffstat (limited to 'src')
-rw-r--r--src/idevice.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/idevice.c b/src/idevice.c
index cad1431..af87e61 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -504,9 +504,13 @@ static ssize_t internal_ssl_read(gnutls_transport_ptr_t transport, char *buffer,
static ssize_t internal_ssl_write(gnutls_transport_ptr_t transport, char *buffer, size_t length)
{
uint32_t bytes = 0;
+ idevice_error_t res;
idevice_connection_t connection = (idevice_connection_t)transport;
debug_info("pre-send length = %zi", length);
- internal_connection_send(connection, buffer, length, &bytes);
+ if ((res = internal_connection_send(connection, buffer, length, &bytes)) != IDEVICE_E_SUCCESS) {
+ debug_info("ERROR: internal_connection_send returned %d", res);
+ return -1;
+ }
debug_info("post-send sent %i bytes", bytes);
return bytes;
}