about summary refs log tree commit diff
path: root/misc/getpass.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc/getpass.c')
-rw-r--r--misc/getpass.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/misc/getpass.c b/misc/getpass.c
index ec535c1cca..bea2ac0d08 100644
--- a/misc/getpass.c
+++ b/misc/getpass.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1993, 1994, 1995 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
@@ -77,8 +77,13 @@ getpass (prompt)
   if (nread < 0 && buf != NULL)
     buf[0] = '\0';
   else if (buf[nread - 1] == '\n')
-    /* Remove the newline.  */
-    buf[nread - 1] = '\0';
+    {
+      /* Remove the newline.  */
+      buf[nread - 1] = '\0';
+      if (echo_off)
+	/* Write the newline that was not echoed.  */
+	putc ('\n', out);
+    }
 
   /* Restore echoing.  */
   if (echo_off)