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 D312BA04A4; Wed, 2 Mar 2022 10:20:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 804E442715; Wed, 2 Mar 2022 10:20:49 +0100 (CET) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by mails.dpdk.org (Postfix) with ESMTP id ADD0740141 for ; Wed, 2 Mar 2022 10:20:47 +0100 (CET) Received: by mail-ej1-f46.google.com with SMTP id r13so2346966ejd.5 for ; Wed, 02 Mar 2022 01:20:47 -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=j6cOgT8MdDnxtiD213Nf+nUy69hBAzy26eFvEQVYGwA=; b=X6vczMn17voGgZ0J5++9kcnxERt/UCHyriZasU4ElrquD4RB/+9rWUHg3a6wQnrvMd NeUw2HIYKw5KzvVNs3NtH3CxrTocN3lvxMa50G0hhbTtXhHnWE9r7o70sQTG/QWS9Cwa zl1NG18XV2T6UmqPm0oS4iczpFxRVbPTKU2bR5m97p1uQxdHcmKxp/8cJAjOdA9zZ9as s8vdoOQN/D1kcZVMYORXU8iITiBari+D9c1VXqTAAbO93YXoM/ZQAzvd3XRFPefa1xy5 11RlUy3xJRkwJCVuwzTcGjP6snzZ44CQhzWSLcowZ+MXYdk6+LVzCWz0quYeK2q3xA5P qFIg== 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=j6cOgT8MdDnxtiD213Nf+nUy69hBAzy26eFvEQVYGwA=; b=IzAlfBHtzc3za959kwE4iiT9JwTNcF89R+la6kfTXRvEMPpxV6FIGBi1gsJ96i87ro UctYdlUMLP9EjcNO636zX1z4tIvqoyY0yHvgnTdN7Nw81NyDLbP57Gk/IIUIhlpu30Q8 q/sCwK83Fj8HFuEGnf6nygubPRsIwhENW3UjFR6mf+vY976s6RnapALSw4H7HmLcFrvC 4w0rbgZAsDsmYJ/Z4WOOLs6QcJIDAqCJx0cdolAVi+sVnDeKzvltKy+So+hKM5P6bihD uPUztwEC+ryTBQChxaKKgSKx/jPIFowCxD+xSOlJ698lXFrDhxiY7VStRDKiIouY4bdl gD3w== X-Gm-Message-State: AOAM532rXWQavaGa4HgoNZ0Ze8MmnmCw+txM7JFpK8PX6PaiiWCWYdei 2vHn/YjDpLcbMBFmVTZggQ0sYg== X-Google-Smtp-Source: ABdhPJzgdOaMIK5Yj3yzcwcLCsu9Y0De0YQPkNBG4xtZu8Q/05iLmY3PSerJ/LlyD/X6cVXSczRIfw== X-Received: by 2002:a17:906:a057:b0:6cf:2736:ba65 with SMTP id bg23-20020a170906a05700b006cf2736ba65mr22220592ejb.171.1646212846049; Wed, 02 Mar 2022 01:20:46 -0800 (PST) Received: from virtual-Standard-PC-Q35-ICH9-2009.network1 ([203.99.184.187]) by smtp.gmail.com with ESMTPSA id fb21-20020a1709073a1500b006da6eefdf11sm193539ejc.49.2022.03.02.01.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 01:20:45 -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:20:23 +0500 Message-Id: <20220302092023.4847-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 geting 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