ipa: Simplify code in ipa_server_conn_read
By doing this change we remove a duplicated error code path and thus
avoid having to maintain an extra code path with function pointers.
Change-Id: I5bce9f92209cc2fb37b78792e34f7898c71d2327
diff --git a/src/input/ipa.c b/src/input/ipa.c
index 26bf170..554644c 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -336,15 +336,13 @@
LOGIPA(conn, LOGL_DEBUG, "message received\n");
ret = ipa_msg_recv_buffered(ofd->fd, &msg, &conn->pending_msg);
- if (ret < 0) {
+ if (ret <= 0) {
if (ret == -EAGAIN)
return;
- if (ret == -EPIPE || ret == -ECONNRESET)
+ else if (ret == -EPIPE || ret == -ECONNRESET)
LOGIPA(conn, LOGL_ERROR, "lost connection with server\n");
- ipa_server_conn_destroy(conn);
- return;
- } else if (ret == 0) {
- LOGIPA(conn, LOGL_ERROR, "connection closed with server\n");
+ else if (ret == 0)
+ LOGIPA(conn, LOGL_ERROR, "connection closed with server\n");
ipa_server_conn_destroy(conn);
return;
}