Fix: shutdown communication socket on -EINVAL
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 14 May 2021 19:24:27 +0000 (15:24 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 14 May 2021 19:25:37 +0000 (15:25 -0400)
Found by Coverity:
>>>     CID 1453150:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "(void)ustcomm_shutdown_unix...".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I151e86167e8467ce3b602ddd0258284e0ef53eaa

src/lib/lttng-ust-ctl/ustctl.c

index 46a1c89dee6f568a21188c12c840fe79222280be..784cb75db0b46a7c42a9b506199a3e10e2baf343 100644 (file)
@@ -394,15 +394,15 @@ int lttng_ust_ctl_add_context(int sock, struct lttng_ust_context_attr *ctx,
        }
        ret = ustcomm_recv_app_reply(sock, &lur, lum.handle, lum.cmd);
        if (ret < 0) {
+               if (ret == -EINVAL) {
+                       /*
+                        * Command unknown from remote end. The communication socket is
+                        * now out-of-sync and needs to be shutdown.
+                        */
+                       (void) ustcomm_shutdown_unix_sock(sock);
+               }
                goto end;
-       } else if (ret == -EINVAL) {
-               /*
-                * Command unknown from remote end. The communication socket is
-                * now out-of-sync and needs to be shutdown.
-                */
-               (void) ustcomm_shutdown_unix_sock(sock);
        }
-
        context_data->handle = -1;
        DBG("Context created successfully");
        *_context_data = context_data;
This page took 0.027034 seconds and 4 git commands to generate.