summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-08-07 02:05:40 +0200
committerGravatar Nikias Bassen2010-08-07 02:05:40 +0200
commitd133d337087ebb3171596c428715821eb0780ff5 (patch)
treeef79e11e3234bbf2c153316388c991843a6ad785
parentb55329772d632f45bad7f84b4aec964c335e406d (diff)
downloadlibimobiledevice-d133d337087ebb3171596c428715821eb0780ff5.tar.gz
libimobiledevice-d133d337087ebb3171596c428715821eb0780ff5.tar.bz2
idevicesyslog: terminate on receive errors (e.g. device unplugging)
-rw-r--r--tools/idevicesyslog.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c
index dcd8df6..f2b3a2f 100644
--- a/tools/idevicesyslog.c
+++ b/tools/idevicesyslog.c
@@ -118,6 +118,11 @@ int main(int argc, char *argv[])
uint32_t datalen = 0, bytes = 0, recv_bytes = 0;
ret = idevice_connection_receive(conn, (char *) &datalen, sizeof(datalen), &bytes);
+ if (ret < 0) {
+ fprintf(stderr, "Error receiving data. Exiting...\n");
+ break;
+ }
+
datalen = GUINT32_FROM_BE(datalen);
if (datalen == 0)