Fix: ustctl need to send the second fd upon error of 1st fd
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 9 Apr 2012 15:02:42 +0000 (11:02 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 9 Apr 2012 19:22:21 +0000 (15:22 -0400)
Otherwise cause protocol discrepancy between ust and sessiond upon send
error. The sessiond will wait for an fd that never arrives.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust/lttng-ust-comm.c

index e3afe6af562cb8a22207ca90210b3450b8d2453d..0116b5f744160cab7d4077146d4a532f606359d8 100644 (file)
@@ -325,14 +325,20 @@ end:
             || lum->cmd == LTTNG_UST_CHANNEL
             || lum->cmd == LTTNG_UST_METADATA)
                        && lur.ret_code == USTCOMM_OK) {
+               int sendret = 0;
+
                /* we also need to send the file descriptors. */
                ret = ustcomm_send_fds_unix_sock(sock,
                        &shm_fd, &shm_fd,
                        1, sizeof(int));
                if (ret < 0) {
                        perror("send shm_fd");
-                       goto error;
+                       sendret = ret;
                }
+               /*
+                * The sessiond expects 2 file descriptors, even upon
+                * error.
+                */
                ret = ustcomm_send_fds_unix_sock(sock,
                        &wait_fd, &wait_fd,
                        1, sizeof(int));
@@ -340,6 +346,10 @@ end:
                        perror("send wait_fd");
                        goto error;
                }
+               if (sendret) {
+                       ret = sendret;
+                       goto error;
+               }
        }
        /*
         * We still have the memory map reference, and the fds have been
This page took 0.025906 seconds and 4 git commands to generate.