From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 11613A09EC; Wed, 19 Oct 2022 20:52:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E9C6C42BFA; Wed, 19 Oct 2022 20:52:48 +0200 (CEST) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mails.dpdk.org (Postfix) with ESMTP id 381F242BF9 for ; Wed, 19 Oct 2022 20:52:48 +0200 (CEST) Received: by mail-pl1-f170.google.com with SMTP id z20so18097845plb.10 for ; Wed, 19 Oct 2022 11:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4n0+/ddCXfGH1ycmC+XcuCpCnOqEtPHREy6r/2TvR9U=; b=cAbVNgB/5uDh0ZsmGWc41yJkAMVkbgycuuq7gSlob7oiCRcbmPvOZZtLtLStjS1b8a d9/exOjHJp8j7uuwIyMqLwN4esf1BmSl8Hs1ZVKcGCsbk3d3CQP4f9Jv2i00tHyKqkRp czKvW44gMXwTritvFQQDrxDExaVkub+kqROft+tXXd+lYAth8yU+AZ8GA2ImvzLgqo63 Y/3k1Thgen+A/iavmb9pKKZGO+rw3U968eHY+3BHmYE7mHsstgtiEIklwODGe1Rvk2BH LMOLv/Fj4Mmi51ktNB5L53HBBbMvx+MAaC9YGydnK7B+ebmQyER4csyBTPR1aNNJuSTz 28gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4n0+/ddCXfGH1ycmC+XcuCpCnOqEtPHREy6r/2TvR9U=; b=4MJFjTPWJGATA97ff8prtepvx6Adh6kabWl+cSELaniMEyUKER8LoZT8Ur2ABW5p4E /I5jrPvX1tlmzgKSbf8hCWP7P+d9E3QNdxc6VyETbG3jMZA62U4EwHS5p4kuQmw2musD gP5Kw45E4IpVn0IPVRS3xe1WMm7sEcwlxwvXRpULltR9uGnvprmkITmVUaaSv3HLulfW 0SifnGrq7DSJzS70EeP+RkX79HjACAe7vnTXlWazvlwSkOnEsReflGo7hPEV8f44r2G2 7DX0SWIay+fX1Cn5bVQi/+cgKUSrmXZZuWsmFWE/2HvMVqcRBH0o4jh1/Kuqz3wIpmsE cB9w== X-Gm-Message-State: ACrzQf3hcqwOn5r6z1ZwhD26emw6PLdcTdDc5q+5nbEAlIV/ce+V6NgZ 0ELAoAH7/qsX4p/yLQ6dPsatCDG3gEwx7A== X-Google-Smtp-Source: AMsMyM5bdrVt1CAXrC+mAf3GYU8lZRqKmo88B1pTnYrfS/frQJGD9sX7l3VE6ucteNVcW7LIpZ7GMQ== X-Received: by 2002:a17:902:da90:b0:185:5537:f388 with SMTP id j16-20020a170902da9000b001855537f388mr10231968plx.113.1666205567178; Wed, 19 Oct 2022 11:52:47 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id k14-20020a17090a404e00b0020a71ca2cb8sm250790pjg.56.2022.10.19.11.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 11:52:46 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v2] dumpcap: fix pathname for output file Date: Wed, 19 Oct 2022 11:52:44 -0700 Message-Id: <20221019185244.76519-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221019183255.74217-1-stephen@networkplumber.org> References: <20221019183255.74217-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org When dumpcap is run with a longer path name such as when testing, the file prefix would be computed incorrectly. Also, print out the resulting filename which is what similar wireshark program does. Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application") Signed-off-by: Stephen Hemminger --- v2 - get rid of debug printf app/dumpcap/main.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/dumpcap/main.c b/app/dumpcap/main.c index e0a3477d912f..9f716b1fbe43 100644 --- a/app/dumpcap/main.c +++ b/app/dumpcap/main.c @@ -637,6 +637,7 @@ static dumpcap_out_t create_output(void) else { mode_t mode = group_read ? 0640 : 0600; + fprintf(stderr, "File: %s\n", output_name); fd = open(output_name, O_WRONLY | O_CREAT, mode); if (fd < 0) rte_exit(EXIT_FAILURE, "Can not open \"%s\": %s\n", @@ -784,8 +785,14 @@ int main(int argc, char **argv) struct rte_ring *r; struct rte_mempool *mp; dumpcap_out_t out; + char *p; - progname = argv[0]; + p = strrchr(argv[0], '/'); + if (p == NULL) + progname = argv[0]; + else + progname = p + 1; + printf("progname = '%s'\n", progname); parse_opts(argc, argv); dpdk_init(); -- 2.35.1