From: Francis Deslauriers Date: Tue, 1 Oct 2019 19:46:35 +0000 (-0400) Subject: Fix: relayd: unchecked return values X-Git-Tag: v2.12.0-rc1~326 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7303993696ea5830d14b26c17c0da42927318e21;p=lttng-tools.git Fix: relayd: unchecked return values Coverity reports: CID 1171571 (#1 of 1): Unchecked return value (CHECKED_RETURN) 24. check_return: Calling compat_epoll_add without checking return value (as is done elsewhere 11 out of 13 times). CID 1171572 (#1 of 1): Unchecked return value (CHECKED_RETURN) 24. check_return: Calling compat_epoll_add without checking return value (as is done elsewhere 11 out of 13 times). Reported-by: Coverity (1171571) Unchecked return value Reported-by: Coverity (1171572) Unchecked return value Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/live.c b/src/bin/lttng-relayd/live.c index 88bb7363d..74c28a457 100644 --- a/src/bin/lttng-relayd/live.c +++ b/src/bin/lttng-relayd/live.c @@ -2055,8 +2055,13 @@ restart: if (ret < 0) { goto error; } - lttng_poll_add(&events, conn->sock->fd, + ret = lttng_poll_add(&events, + conn->sock->fd, LPOLLIN | LPOLLRDHUP); + if (ret) { + ERR("Failed to add new live connection file descriptor to poll set"); + goto error; + } connection_ht_add(viewer_connections_ht, conn); DBG("Connection socket %d added to poll", conn->sock->fd); } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) { diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index 5b32341cd..6720eca96 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -3403,8 +3403,13 @@ restart: if (ret < 0) { goto error; } - lttng_poll_add(&events, conn->sock->fd, + ret = lttng_poll_add(&events, + conn->sock->fd, LPOLLIN | LPOLLRDHUP); + if (ret) { + ERR("Failed to add new connection file descriptor to poll set"); + goto error; + } connection_ht_add(relay_connections_ht, conn); DBG("Connection socket %d added", conn->sock->fd); } else if (revents & (LPOLLERR | LPOLLHUP | LPOLLRDHUP)) {