Fix: Close socket handle on error
[lttng-tools.git] / src / bin / lttng-sessiond / client.c
index 956dab8c867413b5cc4e2c79c75cd5e8e1a3bd28..870277534ec2e1f50dc614b1884f73460f984299 100644 (file)
@@ -1985,8 +1985,11 @@ static int create_client_sock(void)
        /* File permission MUST be 660 */
        ret = chmod(config.client_unix_sock_path.value, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
        if (ret < 0) {
-               ERR("Set file permissions failed: %s", config.client_unix_sock_path.value);
+               ERR("Set file permissions failed: %s",
+                               config.client_unix_sock_path.value);
                PERROR("chmod");
+               (void) lttcomm_close_unix_sock(client_sock);
+               ret = -1;
                goto end;
        }
        DBG("Created client socket (fd = %i)", client_sock);
This page took 0.023032 seconds and 4 git commands to generate.