hush: GETOPT_RESET() _after_ getopts too.

NOEXEC'ed applets which use getopt() need this.

function                                             old     new   delta
builtin_getopts                                      403     413     +10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2017-08-29 14:32:17 +02:00
parent 55af51c66d
commit 6016181b68
4 changed files with 6 additions and 5 deletions

View File

@@ -1212,7 +1212,7 @@ uint32_t getopt32long(char **argv, const char *optstring, const char *longopts,
* By ~2008, OpenBSD 3.4 was changed to survive glibc-like optind = 0
* (to interpret it as if optreset was set).
*/
#ifdef __GLIBC__
#if 1 /*def __GLIBC__*/
#define GETOPT_RESET() (optind = 0)
#else /* BSD style */
#define GETOPT_RESET() (optind = 1)