Fix: lttng-ust-comm.c: return number of fd rather size of array
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 26 Nov 2019 16:16:30 +0000 (11:16 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 13 Feb 2020 17:17:52 +0000 (12:17 -0500)
There are two conflicting comments for this function. One says it
returns the size of the received data and the other says it returns the
number of fd received.

It's more useful to receive the number of fd.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I74084b461d396c3e623fa55100e6dd7e59dbea83

liblttng-ust-comm/lttng-ust-comm.c

index 92d86d4ecbfb0c2309a7126366ae5da6fdd7272b..4ed9cc6edc8931061e2cc52fa97964f6bb4d7969 100644 (file)
@@ -438,8 +438,6 @@ ssize_t ustcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd)
 /*
  * Recv a message accompanied by fd(s) from a unix socket.
  *
- * Returns the size of received data, or negative error value.
- *
  * Expect at most "nb_fd" file descriptors. Returns the number of fd
  * actually received in nb_fd.
  * Returns -EPIPE on orderly shutdown.
@@ -509,7 +507,7 @@ ssize_t ustcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd)
                goto end;
        }
        memcpy(fds, CMSG_DATA(cmsg), sizeof_fds);
-       ret = sizeof_fds;
+       ret = nb_fd;
 end:
        return ret;
 }
This page took 0.025798 seconds and 4 git commands to generate.