From d133d337087ebb3171596c428715821eb0780ff5 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sat, 7 Aug 2010 02:05:40 +0200 Subject: idevicesyslog: terminate on receive errors (e.g. device unplugging) --- tools/idevicesyslog.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tools') 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) -- cgit v1.1-32-gdbae