From: Bruno Haible Date: Tue, 26 May 2020 15:56:31 +0000 (+0200) Subject: getpass: Make more robust in multithreaded applications. X-Git-Tag: v1.0~4057 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=0f36ac3a248df78ee29a5ba69a835c6fce55e830;p=gnulib.git getpass: Make more robust in multithreaded applications. * lib/getpass.c (getpass): Pass an 'e' flag to fopen. * modules/getpass (Depends-on): Add fopen-gnu. --- diff --git a/ChangeLog b/ChangeLog index b50727e59c..a9f542fede 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2020-05-27 Bruno Haible + + 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 getloadavg: Make more robust in multithreaded applications. diff --git a/lib/getpass.c b/lib/getpass.c index af8d72e626..3b0552ec58 100644 --- a/lib/getpass.c +++ b/lib/getpass.c @@ -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; diff --git a/modules/getpass b/modules/getpass index 7e73451eb4..74d781aff2 100644 --- a/modules/getpass +++ b/modules/getpass @@ -9,6 +9,7 @@ m4/getpass.m4 Depends-on: unistd extensions +fopen-gnu fseeko getline stdbool