eal: do not panic on argument parsing error
authorAaron Conole <aconole@redhat.com>
Wed, 22 Mar 2017 20:19:30 +0000 (16:19 -0400)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 27 Mar 2017 13:52:08 +0000 (15:52 +0200)
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 <aconole@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
lib/librte_eal/bsdapp/eal/eal.c
lib/librte_eal/linuxapp/eal/eal.c

index 60de9f9..ab34c0d 100644 (file)
@@ -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 &&
index 161f726..a671ed4 100644 (file)
@@ -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 &&