From 49941f1d5730743bf67e3f022ce35982124702e0 Mon Sep 17 00:00:00 2001 From: yangguangcai Date: Sun, 18 Feb 2024 17:12:19 +0800 Subject: [PATCH] cmd_date:Set optind to zero in the error case. Signed-off-by: yangguangcai --- nshlib/nsh_timcmds.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nshlib/nsh_timcmds.c b/nshlib/nsh_timcmds.c index a806e97a9..e34dd7fba 100644 --- a/nshlib/nsh_timcmds.c +++ b/nshlib/nsh_timcmds.c @@ -434,6 +434,7 @@ int cmd_date(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) return ret; errout: + optind = 0; nsh_error(vtbl, errfmt, argv[0]); return ERROR; }