hush: reuse "OPTIND=..." string
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 29 Aug 2017 11:48:49 +0000 (13:48 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 29 Aug 2017 11:48:49 +0000 (13:48 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/hush.c

index ceb8cbb0ab838e318c23ddd1137b2bacf102ba7b..8e00225319dc3815f37c8dfeea3537bc056a9710 100644 (file)
@@ -2218,7 +2218,8 @@ static int set_local_var(char *str, unsigned flags)
        if (name_len == 4 && cur->varstr[0] == 'P' && cur->varstr[1] == 'S')
                cmdedit_update_prompt();
 #if ENABLE_HUSH_GETOPTS
-       if (strncmp(cur->varstr, "OPTIND=", 7) == 0)
+       /* defoptindvar is a "OPTIND=..." constant string */
+       if (strncmp(cur->varstr, defoptindvar, 7) == 0)
                G.getopt_count = 0;
 #endif
        if (cur->flg_export) {