From 0d81cd0332e72d6c2ed91dc58184229a92b28196 Mon Sep 17 00:00:00 2001 From: José Bollo Date: Tue, 9 Feb 2016 17:43:41 +0100 Subject: afm-main-plugin: utils-jbus: fix bug that blocked MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id31e2c93a1a128d768f9a55fdc739b0067b85121 Signed-off-by: José Bollo --- plugins/afm-main-plugin/utils-jbus.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'plugins/afm-main-plugin/utils-jbus.c') diff --git a/plugins/afm-main-plugin/utils-jbus.c b/plugins/afm-main-plugin/utils-jbus.c index 1f85a4cd..67e3ce4c 100644 --- a/plugins/afm-main-plugin/utils-jbus.c +++ b/plugins/afm-main-plugin/utils-jbus.c @@ -669,6 +669,7 @@ int jbus_dispatch_multiple(struct jbus **jbuses, int njbuses, int maxcount) for (i = r = 0 ; i < njbuses && r < maxcount ; i++) { dbus_connection_read_write(jbuses[i]->connection, 0); + sts = dbus_connection_get_dispatch_status(jbuses[i]->connection); while(sts == DBUS_DISPATCH_DATA_REMAINS && r < maxcount) { sts = dbus_connection_dispatch(jbuses[i]->connection); r++; @@ -690,10 +691,17 @@ int jbus_read_write_dispatch_multiple(struct jbus **jbuses, int njbuses, int tom assert(fds != NULL); r = jbus_dispatch_multiple(jbuses, njbuses, maxcount); + if (r) + return r; n = jbus_fill_pollfds(jbuses, njbuses, fds); - s = poll(fds, n, toms); - if (s < 0) - return r ? r : s; + for(;;) { + s = poll(fds, n, toms); + if (s >= 0) + break; + if (errno != EINTR) + return r ? r : s; + toms = 0; + } n = jbus_dispatch_pollfds(jbuses, njbuses, fds, maxcount - r); return n >= 0 ? r + n : r ? r : n; } -- cgit 1.2.3-korg