aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/getpass.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/misc/getpass.c b/misc/getpass.c
index 0187ac4957..8c6cf568a5 100644
--- a/misc/getpass.c
+++ b/misc/getpass.c
@@ -79,16 +79,18 @@ getpass (prompt)
/* Read the password. */
nread = __getline (&buf, &bufsize, in);
if (buf != NULL)
- if (nread < 0)
- buf[0] = '\0';
- else if (buf[nread - 1] == '\n')
- {
- /* Remove the newline. */
- buf[nread - 1] = '\0';
- if (tty_changed)
- /* Write the newline that was not echoed. */
- putc_unlocked ('\n', out);
- }
+ {
+ if (nread < 0)
+ buf[0] = '\0';
+ else if (buf[nread - 1] == '\n')
+ {
+ /* Remove the newline. */
+ buf[nread - 1] = '\0';
+ if (tty_changed)
+ /* Write the newline that was not echoed. */
+ putc_unlocked ('\n', out);
+ }
+ }
/* Restore the original setting. */
if (tty_changed)