lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
* [PATCH lttng-tools] Fix: Close socket handle on error
@ 2019-09-20 15:34 Jonathan Rajotte
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Rajotte @ 2019-09-20 15:34 UTC (permalink / raw)
  To: lttng-dev; +Cc: jgalar

Fixes coverity #1399739

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
---
 src/bin/lttng-sessiond/client.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/bin/lttng-sessiond/client.c b/src/bin/lttng-sessiond/client.c
index 956dab8c8..870277534 100644
--- a/src/bin/lttng-sessiond/client.c
+++ b/src/bin/lttng-sessiond/client.c
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH lttng-tools] Fix: Close socket handle on error
       [not found] <20190920153421.67837-1-jonathan.rajotte-julien@efficios.com>
@ 2019-09-20 21:23 ` Jérémie Galarneau
  0 siblings, 0 replies; 2+ messages in thread
From: Jérémie Galarneau @ 2019-09-20 21:23 UTC (permalink / raw)
  To: Jonathan Rajotte; +Cc: lttng-dev, jgalar

Merged in master and stable-2.11. Thanks!

Jérémie

On Fri, Sep 20, 2019 at 11:34:21AM -0400, Jonathan Rajotte wrote:
> Fixes coverity #1399739
> 
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
> ---
>  src/bin/lttng-sessiond/client.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/src/bin/lttng-sessiond/client.c b/src/bin/lttng-sessiond/client.c
> index 956dab8c8..870277534 100644
> --- a/src/bin/lttng-sessiond/client.c
> +++ b/src/bin/lttng-sessiond/client.c
> @@ -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);
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-20 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-20 15:34 [PATCH lttng-tools] Fix: Close socket handle on error Jonathan Rajotte
     [not found] <20190920153421.67837-1-jonathan.rajotte-julien@efficios.com>
2019-09-20 21:23 ` Jérémie Galarneau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).