From a0222a4679e085bbce18264d28a08656391c46ee Mon Sep 17 00:00:00 2001 From: Aaron Conole Date: Wed, 22 Mar 2017 16:19:30 -0400 Subject: [PATCH] eal: do not panic on argument parsing error It's possible that the application could take a corrective action here, and either prompt the user for different arguments, or at least perform a better logging. Exiting this early prevents any useful information gathering from the application layer. Signed-off-by: Aaron Conole Acked-by: Bruce Richardson --- lib/librte_eal/bsdapp/eal/eal.c | 8 ++++++-- lib/librte_eal/linuxapp/eal/eal.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 60de9f9b47..ab34c0df71 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -528,8 +528,12 @@ rte_eal_init(int argc, char **argv) } fctret = eal_parse_args(argc, argv); - if (fctret < 0) - exit(1); + if (fctret < 0) { + rte_eal_init_alert("Invalid 'command line' arguments."); + rte_errno = EINVAL; + rte_atomic32_clear(&run_once); + return -1; + } if (internal_config.no_hugetlbfs == 0 && internal_config.process_type != RTE_PROC_SECONDARY && diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 161f726c6c..a671ed4639 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -785,8 +785,12 @@ rte_eal_init(int argc, char **argv) } fctret = eal_parse_args(argc, argv); - if (fctret < 0) - exit(1); + if (fctret < 0) { + rte_eal_init_alert("Invalid 'command line' arguments."); + rte_errno = EINVAL; + rte_atomic32_clear(&run_once); + return -1; + } if (internal_config.no_hugetlbfs == 0 && internal_config.process_type != RTE_PROC_SECONDARY && -- 2.20.1