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 8D651A04A4; Wed, 2 Mar 2022 10:26:21 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A4ED42719; Wed, 2 Mar 2022 10:26:21 +0100 (CET) Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by mails.dpdk.org (Postfix) with ESMTP id 89DD840141 for ; Wed, 2 Mar 2022 10:26:20 +0100 (CET) Received: by mail-ej1-f44.google.com with SMTP id bg10so2379673ejb.4 for ; Wed, 02 Mar 2022 01:26:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n55fMmLeKFM2AumV5YED1FDOJEvg2spEizuGUuPzhJQ=; b=XHNxv+lTNyNUO1fk4cTlWEzTzjupY+ZQ4Ol2GcTv6gkXr7h0o7ysB8KZz+xxMFXPh/ ha2LCwzJaaj4rRJq7Wz5vuBIfaMyvizSGxVq5KvhmIgAkZDPJ94u51y51dBTaknPGuzN y9/Nwe680a1ia4GHklbmOP7sGpH5/r1dhMIqvfbi+9SHceRmSYxosOcTjx29Tsr3/86h fbzXccOxHaUqomzQPztmCWvheZjB9qY4cCaI/0P+hGMTz7yzjdaAWUXvlOntKfYR/z1X cw2XIFaWN6ibGi2RKZvFxgUUC3ql2XNzI77DvuMLH0KWTRjQ/Y3CfnfmoZJ68/RxXv/1 VQXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n55fMmLeKFM2AumV5YED1FDOJEvg2spEizuGUuPzhJQ=; b=VZjAv0UqatHpIXGLiBxaHNugF4OdTaMzJ3rYSOTIhGY40oaS3cZxqFz0e2yIoie/KM EemnD3EIFFzOnMQbCKZcn8mr7l/621MuPH1K+6Anj1/kinWbT6JdKpFw6BA+Bgn2StsO bYnQ5cAflel1Ot9vGNyDQpyZz4LCpBT+EBeWU3R5gYUbDk9pcS5AgTAOvNkBDfiQgAft TJmOnlTDbJK1NeCgmD/DyM2lfDUAxQ522y5j4eMwZAOeYtK01LdGwgv5J3GscxjNzFUY dJd7uwj9EWXruynKg09hgY48HLIuVQKVtsrSlGdZ4P4WlwjIHqC/xhTZmuUV2IUSgVP+ y0lw== X-Gm-Message-State: AOAM530vnm3kPR2l7OCUEx2dICXzp0u+Zhxrm59z9fpriCnkuQ8m12iJ 46LX26/oD5VcVwQTUGU/7fdhYw== X-Google-Smtp-Source: ABdhPJzG2+XyUeNrePmYzu221zKc5stxqv18E8k/D3uc4kh2hO6RbSMot+A2yDLx+EuegiewdrWjVQ== X-Received: by 2002:a17:906:2f97:b0:6ce:3ef6:94be with SMTP id w23-20020a1709062f9700b006ce3ef694bemr22648538eji.136.1646213180271; Wed, 02 Mar 2022 01:26:20 -0800 (PST) Received: from virtual-Standard-PC-Q35-ICH9-2009.network1 ([203.99.184.187]) by smtp.gmail.com with ESMTPSA id m7-20020aa7c487000000b00413a99bf3a3sm4951410edq.56.2022.03.02.01.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 01:26:19 -0800 (PST) From: "usman.tanveer" To: reshma.pattan@intel.com, stephen@networkplumber.org Cc: dev@dpdk.org, "usman.tanveer" Subject: [PATCH] app/pdump: close program if --pdump argument is missing Date: Wed, 2 Mar 2022 14:26:14 +0500 Message-Id: <20220302092614.5164-1-usman.tanveer@emumba.com> X-Mailer: git-send-email 2.25.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 --pdump is a mandatory argument in pdump application. It should print usage and exit if --pdump argument is missing. The application is not closing and getting stuck. Made the change to print usage and exit when this argument is missing. Signed-off-by: usman.tanveer --- app/pdump/main.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index 04a38e8911..59a6846c65 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -383,14 +383,17 @@ launch_args_parse(int argc, char **argv, char *prgname) { int opt, ret; int option_index; + bool pdump_flag = false; static struct option long_option[] = { {CMD_LINE_OPT_PDUMP, 1, 0, CMD_LINE_OPT_PDUMP_NUM}, {CMD_LINE_OPT_MULTI, 0, 0, CMD_LINE_OPT_MULTI_NUM}, {NULL, 0, 0, 0} }; - if (argc == 1) + if (argc == 1) { pdump_usage(prgname); + return -1; + } /* Parse command line */ while ((opt = getopt_long(argc, argv, " ", @@ -402,6 +405,7 @@ launch_args_parse(int argc, char **argv, char *prgname) pdump_usage(prgname); return -1; } + pdump_flag = true; break; case CMD_LINE_OPT_MULTI_NUM: multiple_core_capture = 1; @@ -412,6 +416,11 @@ launch_args_parse(int argc, char **argv, char *prgname) } } + if (pdump_flag == false) { + pdump_usage(prgname); + return -1; + } + return 0; } @@ -991,11 +1000,9 @@ main(int argc, char **argv) argv += (diag - 2); /* parse app arguments */ - if (argc > 1) { - ret = launch_args_parse(argc, argv, argp[0]); - if (ret < 0) - rte_exit(EXIT_FAILURE, "Invalid argument\n"); - } + ret = launch_args_parse(argc, argv, argp[0]); + if (ret < 0) + rte_exit(EXIT_FAILURE, "Invalid argument\n"); /* create mempool, ring and vdevs info */ create_mp_ring_vdev(); -- 2.25.1