mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
getopt(): Could leave optind in undefined state if argc == 1
This commit is contained in:
@@ -264,6 +264,10 @@ int getopt(int argc, FAR char *const argv[], FAR const char *optstring)
|
||||
return noarg_ret;
|
||||
}
|
||||
|
||||
/* Restore the initial, uninitialized state */
|
||||
|
||||
g_binitialized = false;
|
||||
optind = 1;
|
||||
optopt = '?';
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user