pkarashchenko commented on code in PR #1612:
URL: https://github.com/apache/nuttx-apps/pull/1612#discussion_r1124366162


##########
nshlib/nsh_login.c:
##########
@@ -193,9 +197,37 @@ int nsh_login(FAR struct console_stdio_s *pstate)
 
       write(OUTFD(pstate), g_passwordprompt, strlen(g_passwordprompt));
 
+      /* Disable ECHO if its a tty device */
+
+#ifdef CONFIG_SERIAL_TERMIOS
+      if (isatty(INFD(pstate)))
+        {
+          if (tcgetattr(INFD(pstate), &cfg) == 0)
+            {
+              cfg.c_iflag &= (~ECHO);

Review Comment:
   optional
   ```suggestion
                 cfg.c_iflag &= ~ECHO;
   ```



##########
nshlib/nsh_login.c:
##########
@@ -193,9 +197,37 @@ int nsh_login(FAR struct console_stdio_s *pstate)
 
       write(OUTFD(pstate), g_passwordprompt, strlen(g_passwordprompt));
 
+      /* Disable ECHO if its a tty device */
+
+#ifdef CONFIG_SERIAL_TERMIOS
+      if (isatty(INFD(pstate)))
+        {
+          if (tcgetattr(INFD(pstate), &cfg) == 0)
+            {
+              cfg.c_iflag &= (~ECHO);
+              tcsetattr(INFD(pstate), TCSANOW, &cfg);
+            }
+        }
+#endif
+
       password[0] = '\0';
-      if (readline_fd(pstate->cn_line, CONFIG_NSH_LINELEN,
-                      INFD(pstate), -1) > 0)
+      ret = readline_fd(pstate->cn_line, CONFIG_NSH_LINELEN,
+                      INFD(pstate), -1);

Review Comment:
   ```suggestion
         ret = readline_fd(pstate->cn_line, CONFIG_NSH_LINELEN,
                           INFD(pstate), -1);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to