From patchwork Tue Sep 29 17:49:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Donnefort X-Patchwork-Id: 11806447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8DB36CA for ; Tue, 29 Sep 2020 17:49:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C21E7207F7 for ; Tue, 29 Sep 2020 17:49:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728377AbgI2Rtf (ORCPT ); Tue, 29 Sep 2020 13:49:35 -0400 Received: from foss.arm.com ([217.140.110.172]:48918 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728198AbgI2Rtf (ORCPT ); Tue, 29 Sep 2020 13:49:35 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9836B31B; Tue, 29 Sep 2020 10:49:34 -0700 (PDT) Received: from e120877-lin.cambridge.arm.com (e120877-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1FA2F3F70D; Tue, 29 Sep 2020 10:49:34 -0700 (PDT) From: vincent.donnefort@arm.com To: linux-trace-devel@vger.kernel.org Cc: Vincent Donnefort Subject: [PATCH] trace-cmd: fix extract output option Date: Tue, 29 Sep 2020 18:49:26 +0100 Message-Id: <1601401766-54400-1-git-send-email-vincent.donnefort@arm.com> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org From: Vincent Donnefort During the introduction of instance's output_file copy: 3a206ca ("trace-cmd: Have instances include a copy of its output file") The extract path has been omitted, leading to a broken output option: $ trace-cmd extract -o /foo/bar.dat # Will fallback to ./trace.dat Signed-off-by: Vincent Donnefort diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index bd00457..72a5c8c 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -6622,6 +6622,9 @@ void trace_extract(int argc, char **argv) /* Save the state of tracing_on before starting */ for_all_instances(instance) { + instance->output_file = strdup(ctx.output); + if (!instance->output_file) + die("Failed to allocate output file name for instance"); if (!ctx.manual && instance->flags & BUFFER_FL_PROFILE) enable_profile(ctx.instance);