lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH lttng-tools 1/1] Fix: sessiond: handle NULL control output in session descriptor base path getter
       [not found] <20190905191840.21430-1-mathieu.desnoyers@efficios.com>
@ 2019-09-06 15:36 ` Jérémie Galarneau
  0 siblings, 0 replies; 2+ messages in thread
From: Jérémie Galarneau @ 2019-09-06 15:36 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: lttng-dev, jgalar, joraj

Merged in master and stable-2.11. Thanks!

Jérémie

On Thu, Sep 05, 2019 at 03:18:40PM -0400, Mathieu Desnoyers wrote:
> Creating a session with "lttng create --live" without specifying any
> URL triggers a NULL pointer exception because the output is not set

A NullPointerException, in C?! ;-)

> when getting the session descriptor base path.
> 
> Indeed, the destination output URL will only be set later in
> cmd_create_session_from_descriptor(), when setting the default output.
> 
> When the default output is used, no base path override is possible,
> therefore it is fine to assign the base_path to NULL in the base path
> getter.
> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> ---
>  src/common/session-descriptor.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/common/session-descriptor.c b/src/common/session-descriptor.c
> index b5fdb067..208eb46f 100644
> --- a/src/common/session-descriptor.c
> +++ b/src/common/session-descriptor.c
> @@ -1186,8 +1186,12 @@ int lttng_session_descriptor_get_base_path(struct lttng_session_descriptor *dst,
>  	switch (dst->output_type) {
>  	case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK:
>  	{
> -		*_base_path = dst->output.network.control->subdir[0] ?
> -				dst->output.network.control->subdir : NULL;
> +		if (dst->output.network.control &&
> +				dst->output.network.control->subdir[0]) {
> +			*_base_path = dst->output.network.control->subdir;
> +		} else {
> +			*_base_path = NULL;
> +		}
>  		break;
>  	}
>  	case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL:
> -- 
> 2.11.0
> 

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

* [PATCH lttng-tools 1/1] Fix: sessiond: handle NULL control output in session descriptor base path getter
@ 2019-09-05 19:18 Mathieu Desnoyers
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2019-09-05 19:18 UTC (permalink / raw)
  To: jgalar, joraj; +Cc: lttng-dev

Creating a session with "lttng create --live" without specifying any
URL triggers a NULL pointer exception because the output is not set
when getting the session descriptor base path.

Indeed, the destination output URL will only be set later in
cmd_create_session_from_descriptor(), when setting the default output.

When the default output is used, no base path override is possible,
therefore it is fine to assign the base_path to NULL in the base path
getter.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
 src/common/session-descriptor.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/common/session-descriptor.c b/src/common/session-descriptor.c
index b5fdb067..208eb46f 100644
--- a/src/common/session-descriptor.c
+++ b/src/common/session-descriptor.c
@@ -1186,8 +1186,12 @@ int lttng_session_descriptor_get_base_path(struct lttng_session_descriptor *dst,
 	switch (dst->output_type) {
 	case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_NETWORK:
 	{
-		*_base_path = dst->output.network.control->subdir[0] ?
-				dst->output.network.control->subdir : NULL;
+		if (dst->output.network.control &&
+				dst->output.network.control->subdir[0]) {
+			*_base_path = dst->output.network.control->subdir;
+		} else {
+			*_base_path = NULL;
+		}
 		break;
 	}
 	case LTTNG_SESSION_DESCRIPTOR_OUTPUT_TYPE_LOCAL:
-- 
2.11.0

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

end of thread, other threads:[~2019-09-06 15:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190905191840.21430-1-mathieu.desnoyers@efficios.com>
2019-09-06 15:36 ` [PATCH lttng-tools 1/1] Fix: sessiond: handle NULL control output in session descriptor base path getter Jérémie Galarneau
2019-09-05 19:18 Mathieu Desnoyers

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).