Re: [PATCH] trace-cmd: Do not use instance from trace context

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 29 Jul 2022 07:01:16 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote:

> When trace-cmd initiates a connection to a trace agent over the network,
> the logic in connect_to_agent() function incorrectly uses the last
> instance saved in the trace context, instead of the actual instance
> which is passed as input argument. This works if the remote agent is
> set last on the command line, but causes a problem if there is more than
> one agent or if there is a local buffer after the agent on the command
> line.
> 
> Reported-by: Alexander Aring <aahringo@xxxxxxxxxx>
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx>
> ---
>  tracecmd/trace-record.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
> index 2406489a..50039dad 100644
> --- a/tracecmd/trace-record.c
> +++ b/tracecmd/trace-record.c
> @@ -3934,15 +3934,15 @@ static void connect_to_agent(struct common_record_context *ctx,
>  		use_fifos = nr_fifos > 0;
>  	}
>  
> -	if (ctx->instance->result) {
> +	if (instance->result) {

Bah, I kept getting confused by when to use instance vs ctx->instance,
and I guess I messed this one up.

Thanks Tzvetomir on fixing it.

-- Steve


>  		role = TRACECMD_TIME_SYNC_ROLE_CLIENT;
> -		sd = connect_addr(ctx->instance->result);
> +		sd = connect_addr(instance->result);
>  		if (sd < 0)
>  			die("Failed to connect to host %s:%u",
>  			    instance->name, instance->port);
>  	} else {
>  		/* If connecting to a proxy, then this is the guest */
> -		if (is_proxy(ctx->instance))
> +		if (is_proxy(instance))
>  			role = TRACECMD_TIME_SYNC_ROLE_GUEST;
>  		else
>  			role = TRACECMD_TIME_SYNC_ROLE_HOST;




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux