summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2005-05-24 16:09:33 +0000
committermillert <millert@openbsd.org>2005-05-24 16:09:33 +0000
commit09152f7bebfffba69088849ebcbecc9b792b5b67 (patch)
treeb9e66674e295a19db17ce04096c8e0d5b2f74eb4 /lib/libc
parentlet ramdisks compile again. people -- please always try to compile with your new options off, too (diff)
downloadwireguard-openbsd-09152f7bebfffba69088849ebcbecc9b792b5b67.tar.xz
wireguard-openbsd-09152f7bebfffba69088849ebcbecc9b792b5b67.zip
Restoration of terminal settings can be broken by a well-timed signal,
e.g. a terminating scp killing its ssh child so retry on EINTR. From peak@argo.troja.mff.cuni.cz via portable openssh bugzilla #905
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/readpassphrase.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libc/gen/readpassphrase.c b/lib/libc/gen/readpassphrase.c
index 2eb7eb5d69d..ece1423d509 100644
--- a/lib/libc/gen/readpassphrase.c
+++ b/lib/libc/gen/readpassphrase.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readpassphrase.c,v 1.16 2003/06/17 21:56:23 millert Exp $ */
+/* $OpenBSD: readpassphrase.c,v 1.17 2005/05/24 16:09:33 millert Exp $ */
/*
* Copyright (c) 2000-2002 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -21,7 +21,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$OpenBSD: readpassphrase.c,v 1.16 2003/06/17 21:56:23 millert Exp $";
+static const char rcsid[] = "$OpenBSD: readpassphrase.c,v 1.17 2005/05/24 16:09:33 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <ctype.h>
@@ -126,8 +126,11 @@ restart:
(void)write(output, "\n", 1);
/* Restore old terminal settings and signals. */
- if (memcmp(&term, &oterm, sizeof(term)) != 0)
- (void)tcsetattr(input, TCSANOW|TCSASOFT, &oterm);
+ if (memcmp(&term, &oterm, sizeof(term)) != 0) {
+ while (tcsetattr(input, TCSANOW|TCSASOFT, &oterm) == -1 &&
+ errno == EINTR)
+ continue;
+ }
(void)sigaction(SIGALRM, &savealrm, NULL);
(void)sigaction(SIGHUP, &savehup, NULL);
(void)sigaction(SIGINT, &saveint, NULL);