From 00bd76728d44901a260f2dcdbeed52b3c85d6b6b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 6 Apr 2018 14:57:53 +0200 Subject: [PATCH] hush: if we did match "LINENO" or "OPTIND", stop further comparisons function old new delta handle_changed_special_names 99 101 +2 Signed-off-by: Denys Vlasenko --- shell/hush.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shell/hush.c b/shell/hush.c index 7b59b0ff9..971a16aff 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -2134,12 +2134,16 @@ static void handle_changed_special_names(const char *name, unsigned name_len) && name_len == 6 ) { #if ENABLE_HUSH_LINENO_VAR - if (strncmp(name, "LINENO", 6) == 0) + if (strncmp(name, "LINENO", 6) == 0) { G.lineno_var = NULL; + return; + } #endif #if ENABLE_HUSH_GETOPTS - if (strncmp(name, "OPTIND", 6) == 0) + if (strncmp(name, "OPTIND", 6) == 0) { G.getopt_count = 0; + return; + } #endif } } -- 2.25.1