Fix: relayd: unchecked return values
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 1 Oct 2019 19:46:35 +0000 (15:46 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 4 Oct 2019 20:28:16 +0000 (16:28 -0400)
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 <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/live.c
src/bin/lttng-relayd/main.c

index 88bb7363db962a41e65c8ccff4a6a654cbc666a3..74c28a45784a1962aa9c068a63cccf9461f5a600 100644 (file)
@@ -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)) {
index 5b32341cd9ff4cb2647caa3557536326188dcf47..6720eca9687f6d9633dc9c5928eb904a2ab36d89 100644 (file)
@@ -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)) {
This page took 0.036787 seconds and 4 git commands to generate.