]> Savannah Git Hosting - gnulib.git/commitdiff
getpass: Make more robust in multithreaded applications.
authorBruno Haible <bruno@clisp.org>
Tue, 26 May 2020 15:56:31 +0000 (17:56 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 27 May 2020 17:30:41 +0000 (19:30 +0200)
* lib/getpass.c (getpass): Pass an 'e' flag to fopen.
* modules/getpass (Depends-on): Add fopen-gnu.

ChangeLog
lib/getpass.c
modules/getpass

index b50727e59c5a1a6de095f39aeeb278ce26334513..a9f542fede306fcb3fb4e5fe1aeba3c961e7d651 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-27  Bruno Haible  <bruno@clisp.org>
+
+       getpass: Make more robust in multithreaded applications.
+       * lib/getpass.c (getpass): Pass an 'e' flag to fopen.
+       * modules/getpass (Depends-on): Add fopen-gnu.
+
 2020-05-27  Bruno Haible  <bruno@clisp.org>
 
        getloadavg: Make more robust in multithreaded applications.
index af8d72e626458e56c7840d68b5e4e6a702125cf5..3b0552ec58ce0a70e69c18938846eef74a40bf80 100644 (file)
@@ -96,7 +96,7 @@ getpass (const char *prompt)
   /* Try to write to and read from the terminal if we can.
      If we can't open the terminal, use stderr and stdin.  */
 
-  tty = fopen ("/dev/tty", "w+");
+  tty = fopen ("/dev/tty", "w+e");
   if (tty == NULL)
     {
       in = stdin;
index 7e73451eb44d45242e73a7e559c66a6d28140771..74d781aff2a29df1033364f747fb42accba222e2 100644 (file)
@@ -9,6 +9,7 @@ m4/getpass.m4
 Depends-on:
 unistd
 extensions
+fopen-gnu
 fseeko
 getline
 stdbool