Fix: bad check of accept() return value
[lttng-tools.git] / src / common / consumer.c
index 63c98350a4772435b50a84ae4b0ac25f4e4f3455..1045bfb46101d8a6bb63a8c91157f3ffbf5199a2 100644 (file)
@@ -1334,6 +1334,12 @@ static int write_relayd_metadata_id(int fd,
                        PERROR("write metadata stream id");
                }
                DBG3("Consumer failed to write relayd metadata id (errno: %d)", errno);
+               /*
+                * Set ret to a negative value because if ret != sizeof(hdr), we don't
+                * handle writting the missing part so report that as an error and
+                * don't lie to the caller.
+                */
+               ret = -1;
                goto end;
        }
        DBG("Metadata stream id %" PRIu64 " with padding %lu written before data",
@@ -2597,7 +2603,7 @@ void *consumer_thread_sessiond_poll(void *data)
 
        /* Blocking call, waiting for transmission */
        sock = lttcomm_accept_unix_sock(client_socket);
-       if (sock <= 0) {
+       if (sock < 0) {
                WARN("On accept");
                goto end;
        }
This page took 0.026222 seconds and 5 git commands to generate.