aboutsummaryrefslogtreecommitdiff
path: root/libseat/backend/seatd.c
diff options
context:
space:
mode:
Diffstat (limited to 'libseat/backend/seatd.c')
-rw-r--r--libseat/backend/seatd.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libseat/backend/seatd.c b/libseat/backend/seatd.c
index 0b8064d..2f7b384 100644
--- a/libseat/backend/seatd.c
+++ b/libseat/backend/seatd.c
@@ -288,16 +288,20 @@ static int dispatch(struct backend_seatd *backend) {
if (conn_flush(backend) == -1) {
return -1;
}
- int opcode = 0, res = 0;
- while ((res = dispatch_pending(backend, &opcode)) == 0 && opcode == 0) {
+ while (true) {
+ int opcode = 0;
+ if (dispatch_pending(backend, &opcode) == -1) {
+ log_errorf("Could not dispatch pending messages: %s", strerror(errno));
+ return -1;
+ }
+ if (opcode != 0) {
+ break;
+ }
if (poll_connection(backend, -1) == -1) {
log_errorf("Could not poll connection: %s", strerror(errno));
return -1;
}
}
- if (res == -1) {
- return -1;
- }
return 0;
}