|
Lines 67-72
readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
Link Here
|
| 67 |
struct termios term, oterm; |
67 |
struct termios term, oterm; |
| 68 |
struct sigaction sa, savealrm, saveint, savehup, savequit, saveterm; |
68 |
struct sigaction sa, savealrm, saveint, savehup, savequit, saveterm; |
| 69 |
struct sigaction savetstp, savettin, savettou, savepipe; |
69 |
struct sigaction savetstp, savettin, savettou, savepipe; |
|
|
70 |
sigset_t currset, saveset; |
| 70 |
|
71 |
|
| 71 |
/* I suppose we could alloc on demand in this case (XXX). */ |
72 |
/* I suppose we could alloc on demand in this case (XXX). */ |
| 72 |
if (bufsiz == 0) { |
73 |
if (bufsiz == 0) { |
|
Lines 174-182
restart:
Link Here
|
| 174 |
(void)close(input); |
175 |
(void)close(input); |
| 175 |
|
176 |
|
| 176 |
/* |
177 |
/* |
| 177 |
* If we were interrupted by a signal, resend it to ourselves |
178 |
* If we were interrupted by a signal, resend it to ourselves now that |
| 178 |
* now that we have restored the signal handlers. |
179 |
* we have restored the signal handlers. We need to mask off those |
|
|
180 |
* signals while we do this otherwise kill(2) may block. |
| 179 |
*/ |
181 |
*/ |
|
|
182 |
sigemptyset(&currset); |
| 183 |
for (i = 0; i < _NSIG; i++) |
| 184 |
if (signo[i]) |
| 185 |
sigaddset(&currset, i); |
| 186 |
sigprocmask(SIG_BLOCK, &currset, &saveset); |
| 187 |
|
| 180 |
for (i = 0; i < _NSIG; i++) { |
188 |
for (i = 0; i < _NSIG; i++) { |
| 181 |
if (signo[i]) { |
189 |
if (signo[i]) { |
| 182 |
kill(getpid(), i); |
190 |
kill(getpid(), i); |
|
Lines 188-193
restart:
Link Here
|
| 188 |
} |
196 |
} |
| 189 |
} |
197 |
} |
| 190 |
} |
198 |
} |
|
|
199 |
sigprocmask(SIG_SETMASK, &saveset, NULL); |
| 191 |
if (need_restart) |
200 |
if (need_restart) |
| 192 |
goto restart; |
201 |
goto restart; |
| 193 |
|
202 |
|