← Commit list

a513bf3c3

Denys Vlasenko
Denys Vlasenko
2016-10-26
SUCCESS Duration: 190s

Subject

ash: [BUILTIN] Treat OPTIND=0 in the same way as OPTIND=1

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/ash.c+1 -3
@@ -2019,7 +2019,7 @@ extern struct globals_var *const ash_ptr_to_globals_var;
static void FAST_FUNC
getoptsreset(const char *value)
{
- shellparam.optind = number(value);
+ shellparam.optind = number(value) ?: 1;
shellparam.optoff = -1;
}
#endif
@@ -10571,8 +10571,6 @@ getopts(char *optstr, char *optvar, char **optfirst, int *param_optind, int *opt
sbuf[1] = '\0';
- if (*param_optind < 1)
- return 1;
optnext = optfirst + *param_optind - 1;
if (*param_optind <= 1 || *optoff < 0 || (int)strlen(optnext[-1]) < *optoff)