summaryrefslogtreecommitdiff
path: root/openbsd-compat/readpassphrase.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/readpassphrase.c')
-rw-r--r--openbsd-compat/readpassphrase.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/openbsd-compat/readpassphrase.c b/openbsd-compat/readpassphrase.c
index 783cc9e67..24aed6e46 100644
--- a/openbsd-compat/readpassphrase.c
+++ b/openbsd-compat/readpassphrase.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: readpassphrase.c,v 1.25 2015/09/14 10:45:27 guenther Exp $ */ 1/* $OpenBSD: readpassphrase.c,v 1.26 2016/10/18 12:47:18 millert Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000-2002, 2007, 2010 4 * Copyright (c) 2000-2002, 2007, 2010
@@ -157,9 +157,13 @@ restart:
157 157
158 /* Restore old terminal settings and signals. */ 158 /* Restore old terminal settings and signals. */
159 if (memcmp(&term, &oterm, sizeof(term)) != 0) { 159 if (memcmp(&term, &oterm, sizeof(term)) != 0) {
160 const int sigttou = signo[SIGTTOU];
161
162 /* Ignore SIGTTOU generated when we are not the fg pgrp. */
160 while (tcsetattr(input, TCSAFLUSH|TCSASOFT, &oterm) == -1 && 163 while (tcsetattr(input, TCSAFLUSH|TCSASOFT, &oterm) == -1 &&
161 errno == EINTR && !signo[SIGTTOU]) 164 errno == EINTR && !signo[SIGTTOU])
162 continue; 165 continue;
166 signo[SIGTTOU] = sigttou;
163 } 167 }
164 (void)sigaction(SIGALRM, &savealrm, NULL); 168 (void)sigaction(SIGALRM, &savealrm, NULL);
165 (void)sigaction(SIGHUP, &savehup, NULL); 169 (void)sigaction(SIGHUP, &savehup, NULL);