From 6cfa4f771efe39dbc944e799cbe465134c8931fa Mon Sep 17 00:00:00 2001 From: Christian Ehrhardt Date: Fri, 29 Jul 2016 08:45:28 +0200 Subject: Imported Upstream version 16.07 Change-Id: I8bf3b1fc950b92eb78860f8bc8dd675e06e85e48 Signed-off-by: Christian Ehrhardt --- lib/librte_eal/common/eal_common_options.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/librte_eal/common/eal_common_options.c') diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 481c732b..1a1bab36 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -530,6 +530,13 @@ eal_parse_set(const char *input, uint16_t set[], unsigned num) str = end + 1; } while (*end != '\0' && *end != ')'); + /* + * to avoid failure that tail blank makes end character check fail + * in eal_parse_lcores( ) + */ + while (isblank(*str)) + str++; + return str - input; } @@ -578,13 +585,12 @@ eal_parse_lcores(const char *lcores) struct rte_config *cfg = rte_eal_get_configuration(); static uint16_t set[RTE_MAX_LCORE]; unsigned idx = 0; - int i; unsigned count = 0; const char *lcore_start = NULL; const char *end = NULL; int offset; rte_cpuset_t cpuset; - int lflags = 0; + int lflags; int ret = -1; if (lcores == NULL) @@ -593,9 +599,6 @@ eal_parse_lcores(const char *lcores) /* Remove all blank characters ahead and after */ while (isblank(*lcores)) lcores++; - i = strlen(lcores); - while ((i > 0) && isblank(lcores[i - 1])) - i--; CPU_ZERO(&cpuset); @@ -613,6 +616,8 @@ eal_parse_lcores(const char *lcores) if (*lcores == '\0') goto err; + lflags = 0; + /* record lcore_set start point */ lcore_start = lcores; -- cgit 1.2.3-korg