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 86391A09EB; Wed, 19 Oct 2022 20:33:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D76A42BFA; Wed, 19 Oct 2022 20:33:01 +0200 (CEST) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mails.dpdk.org (Postfix) with ESMTP id A9CAF42BF9 for ; Wed, 19 Oct 2022 20:32:59 +0200 (CEST) Received: by mail-pl1-f174.google.com with SMTP id b2so18069942plc.7 for ; Wed, 19 Oct 2022 11:32:59 -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:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=SObSy8RulRXFiT0d8Loo+ifBKqQmp8funegf3CgRcBE=; b=Bb71PgTJbBuWj9x90Ntr9ImX2z4K3k3SlwmYYV4W0bSd80kjh/asco6tO/GywuGHZk W4S2tdVhA54YZm9oF26X3ti3S+7Qb+SEyDkmnqMI0hA24ZNh4dtYRGRbE7DQyxucG0SK Av4wKQ5edw9b4v/3x1k6cvKMPwJdOx5gVEZuMtCD5Ct2P8Al3ShCBki/lkDyix+Qukp3 TJv1acGRd99+Hq5ZmoK8t7aqWppo/0BCKxxDzIz0bHzE1e1yWQc04YNtKhOVBgmHeNpi wizWgWDEogG9J2t6t2yF/4kxSfsre17HYUhkWvlOHt5UWLZHGeH/6NTWvHp9lYHy87iw 5VeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SObSy8RulRXFiT0d8Loo+ifBKqQmp8funegf3CgRcBE=; b=drOi3xKC/ze3OdWGwSdoxfCkEaKWKGyGtW5LS7Cd35bd7TbnbmihnWzUjffwjZ0xqJ GrQMR0ettDgPT+b2EQrCJsnMhlymFZgUzIpmV5VaUV2Wz2j0Az6fvNW5H4jD4qRPGyWn VrZa7YV9/N0xEec/5oRsww3iqYaGKg6PiL1ima1/eGJOlrK8Enx4D87wKrhTk1N7gJA0 qahJJaxwMDcvRUGK1Qf1MlVkfM36bQGJzNHQJtOijuDtx3pf4xovEYRxhQn1ibVNh6hm qgKRcj8dBkPgl5b2ns2m+rbm79fH1cryBpPTEIiR0Qng/M7yfiLedfenX5q/e/snqSsU CXdg== X-Gm-Message-State: ACrzQf1RY1k/jq5AQ8mva8wOwCCEawulxSvalglX4ce4jt4HozJ5JgUl 2c1EpeZXIG7qzYj3wS30sgTLcVmUbyq30A== X-Google-Smtp-Source: AMsMyM5LUq1mHGe4R9UoqhdDV07vh3d8+Ds8zbhXW/lj6tlxp4hWFB7Huia1XJUe5iPtDjP6554JAg== X-Received: by 2002:a17:90b:3141:b0:20d:49d6:30b with SMTP id ip1-20020a17090b314100b0020d49d6030bmr44862872pjb.223.1666204378538; Wed, 19 Oct 2022 11:32:58 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id ik20-20020a170902ab1400b001730a1af0fbsm11124852plb.23.2022.10.19.11.32.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 11:32:57 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH] dumpcap: fix pathname for output file Date: Wed, 19 Oct 2022 11:32:55 -0700 Message-Id: <20221019183255.74217-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.35.1 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 --- 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