Module Name: src
Committed By: christos
Date: Sun Jan 31 23:41:38 UTC 2016
Modified Files:
src/lib/libc/gen: getpass.c
Log Message:
PR/50695: coypu: ctrl-c in su password input breaks shell (bash, csh)
Always restore the tty settings.
To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/lib/libc/gen/getpass.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/gen/getpass.c
diff -u src/lib/libc/gen/getpass.c:1.29 src/lib/libc/gen/getpass.c:1.30
--- src/lib/libc/gen/getpass.c:1.29 Thu Sep 18 09:58:20 2014
+++ src/lib/libc/gen/getpass.c Sun Jan 31 18:41:38 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: getpass.c,v 1.29 2014/09/18 13:58:20 christos Exp $ */
+/* $NetBSD: getpass.c,v 1.30 2016/01/31 23:41:38 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getpass.c,v 1.29 2014/09/18 13:58:20 christos Exp $");
+__RCSID("$NetBSD: getpass.c,v 1.30 2016/01/31 23:41:38 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -288,12 +288,12 @@ add:
good = true;
restore:
+out:
if (havetty) {
c = errno;
(void)tcsetattr(fd[0], TCSAFLUSH|TCSASOFT, >);
errno = c;
}
-out:
if (good && (flags & GETPASS_ECHO_NL))
(void)write(fd[1], "\n", 1);