[uClibc]getpass() prints password after hitting enter

Vadim Berkgaut berk at rc.ru
Sun Apr 7 11:18:33 UTC 2002


Hi,

I have the same problem. It seems that fopen opens /dev/tty
in block buffering mode, because setting input stream to
line buffering fixes it:

--- uClibc.orig/libc/unistd/getpass.c   Thu Jan 11 14:42:17 2001
+++ uClibc/libc/unistd/getpass.c        Sun Apr  7 14:26:13 2002
@@ -52,8 +52,11 @@
       out = stderr;
     }
   else
-    out = in;
-
+    {
+      setvbuf(in, NULL, _IOLBF, 0);
+      out = in;
+    }
+    
   /* Turn echoing off if it is on now.  */
 
   if (tcgetattr (fileno (in), &t) == 0)

--
  Vadim





More information about the uClibc mailing list