diff --git a/libc/unistd/lib_getopt.c b/libc/unistd/lib_getopt.c index 4399e6140b..bda9666be5 100644 --- a/libc/unistd/lib_getopt.c +++ b/libc/unistd/lib_getopt.c @@ -258,6 +258,7 @@ int getopt(int argc, FAR char *const argv[], FAR const char *optstring) /* No argument was supplied */ + g_optptr = NULL; optarg = NULL; optopt = *optchar; optind++;