From 11617fe5ab8dd8e3ba7f9367e54c9524792d0a1e Mon Sep 17 00:00:00 2001 From: dongjiuzhu Date: Tue, 1 Dec 2020 11:20:54 +0800 Subject: [PATCH] unistd/getopt: remove count of arguments limits For commands without "-" arguments, ex:"ls", we should always let optind = 1 after getopt is called in order to get what follows correctly. Change-Id: Iac3cfbadd27fb96e47070c4e3198229306299b6b Signed-off-by: dongjiuzhu --- libs/libc/unistd/lib_getopt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libc/unistd/lib_getopt.c b/libs/libc/unistd/lib_getopt.c index 4600a71c30..82c097677d 100644 --- a/libs/libc/unistd/lib_getopt.c +++ b/libs/libc/unistd/lib_getopt.c @@ -134,7 +134,7 @@ int getopt(int argc, FAR char * const argv[], FAR const char *optstring) /* Verify input parameters. */ - if (argv != NULL && optstring != NULL && argc > 1) + if (argv != NULL && optstring != NULL) { FAR char *optchar; int noarg_ret = '?';