]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - misc/getpass.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / misc / getpass.c
index 5290c3c7d3a8c3a1131452ce2ce7518b5876d806..8d034249b231873077bfc4daffe83bb4ecc72cf9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-1999,2001,2003,2004,2005 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -12,9 +12,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
 #include <stdio_ext.h>
@@ -25,7 +24,7 @@
 #include <wchar.h>
 #define flockfile(s) _IO_flockfile (s)
 #define funlockfile(s) _IO_funlockfile (s)
-#include <bits/libc-lock.h>
+#include <libc-lock.h>
 
 /* It is desirable to use this bit on systems that have it.
    The only bit of terminal state we want to twiddle is echoing, which is
@@ -44,8 +43,7 @@ call_fclose (void *arg)
 }
 
 char *
-getpass (prompt)
-     const char *prompt;
+getpass (const char *prompt)
 {
   FILE *in, *out;
   struct termios s, t;
@@ -57,7 +55,7 @@ getpass (prompt)
   /* Try to write to and read from the terminal if we can.
      If we can't open the terminal, use stderr and stdin.  */
 
-  in = fopen ("/dev/tty", "w+c");
+  in = fopen ("/dev/tty", "w+ce");
   if (in == NULL)
     {
       in = stdin;
@@ -92,7 +90,7 @@ getpass (prompt)
 
   /* Write the prompt.  */
   __fxprintf (out, "%s", prompt);
-  fflush_unlocked (out);
+  __fflush_unlocked (out);
 
   /* Read the password.  */
   nread = __getline (&buf, &bufsize, in);