summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-05-24 01:43:08 +0200
committerGravatar Martin Szulecki2013-05-24 01:43:08 +0200
commit15c7079984fff9e5cbdef070dca584ca761793dc (patch)
tree11496df970ed5d60f740d1f6588e95aa31240ee6
parent0701c787ea0e7bad71bfe52e977f027ab229c75a (diff)
downloadlibimobiledevice-15c7079984fff9e5cbdef070dca584ca761793dc.tar.gz
libimobiledevice-15c7079984fff9e5cbdef070dca584ca761793dc.tar.bz2
syslog_relay: Make sure syslog worker thread is not stuck forever
-rw-r--r--src/syslog_relay.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/syslog_relay.c b/src/syslog_relay.c
index f1231e1..2936700 100644
--- a/src/syslog_relay.c
+++ b/src/syslog_relay.c
@@ -211,8 +211,10 @@ void *syslog_relay_worker(void *arg)
while (srwt->client->parent) {
char c;
uint32_t bytes = 0;
- ret = syslog_relay_receive_with_timeout(srwt->client, &c, 1, &bytes, 0);
- if (ret < 0 || (bytes != 1)) {
+ ret = syslog_relay_receive_with_timeout(srwt->client, &c, 1, &bytes, 100);
+ if ((bytes == 0) && (ret == SYSLOG_RELAY_E_SUCCESS)) {
+ continue;
+ } else if (ret < 0) {
debug_info("Connection to syslog relay interrupted");
break;
}