From e9f4e87786c0e7d2c8f5693e3f1972e315d32081 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Mon, 25 Sep 2023 11:19:39 +0300 Subject: [PATCH] nsh_alias.c: unalias -a command does not work correctly getopt returns the argument if it is found, so testing against != ERROR is wrong. --- nshlib/nsh_alias.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nshlib/nsh_alias.c b/nshlib/nsh_alias.c index b6ef0c753..b14847cd1 100644 --- a/nshlib/nsh_alias.c +++ b/nshlib/nsh_alias.c @@ -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;