pkarashchenko commented on a change in pull request #5004:
URL: https://github.com/apache/incubator-nuttx/pull/5004#discussion_r769411130



##########
File path: libs/libc/unistd/lib_getopt_common.c
##########
@@ -393,6 +393,14 @@ int getopt_common(int argc, FAR char * const argv[],
 
           /* Check for the end of the argument list */
 
+          if (go->go_optind >= argc)
+            {
+              /* We don't need to check arguments anymore, we are finished */
+
+              go->go_binitialized = false;
+              return ERROR;
+            }
+
           go->go_optptr = argv[go->go_optind];

Review comment:
       Just as alternative shorter solution to get the same result




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to