nsh_alias.c: unalias -a command does not work correctly

getopt returns the argument if it is found, so testing against != ERROR is
wrong.
This commit is contained in:
Ville Juven 2023-09-25 11:19:39 +03:00 committed by Xiang Xiao
parent 851a4aa904
commit e9f4e87786

View File

@ -408,7 +408,7 @@ int cmd_unalias(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
/* If '-a' is provided, then just wipe them all */
if ((option = getopt(argc, argv, "a")) != ERROR)
if ((option = getopt(argc, argv, "a")) == 'a')
{
alias_removeall(vtbl);
return ret;