This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new e9f4e8778 nsh_alias.c: unalias -a command does not work correctly
e9f4e8778 is described below

commit e9f4e87786c0e7d2c8f5693e3f1972e315d32081
Author: Ville Juven <[email protected]>
AuthorDate: Mon Sep 25 11:19:39 2023 +0300

    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;

Reply via email to