cmd_nand: show nand scrub confirmation character
authorFlorian Fainelli <f.fainelli@gmail.com>
Sat, 20 Mar 2010 18:02:58 +0000 (19:02 +0100)
committerScott Wood <scottwood@freescale.com>
Tue, 23 Mar 2010 19:29:10 +0000 (14:29 -0500)
When issuing a nand scrub command, the entered character is not displayed
this may be confusing. This patch makes the input character being
displayed if it is a 'y' so that an user knows he is about to scrub his
nand.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
common/cmd_nand.c

index 075a8afb60a4c22494095d80be9e74c11dba732d..9b0c9305306f7b6c3f55a93e185606b07067a85a 100644 (file)
@@ -327,8 +327,14 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
                             "are sure of what you are doing!\n"
                             "\nReally scrub this NAND flash? <y/N>\n");
 
-                       if (getc() == 'y' && getc() == '\r') {
-                               opts.scrub = 1;
+                       if (getc() == 'y') {
+                               puts("y");
+                               if (getc() == '\r')
+                                       opts.scrub = 1;
+                               else {
+                                       puts("scrub aborted\n");
+                                       return -1;
+                               }
                        } else {
                                puts("scrub aborted\n");
                                return -1;