diff options
-rw-r--r-- | monitor.c | 14 | ||||
-rw-r--r-- | ssh-pkcs11-client.c | 5 |
2 files changed, 12 insertions, 7 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: monitor.c,v 1.178 2018/01/23 05:27:21 djm Exp $ */ | 1 | /* $OpenBSD: monitor.c,v 1.179 2018/02/05 05:37:46 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> | 3 | * Copyright 2002 Niels Provos <provos@citi.umich.edu> |
4 | * Copyright 2002 Markus Friedl <markus@openbsd.org> | 4 | * Copyright 2002 Markus Friedl <markus@openbsd.org> |
@@ -289,8 +289,10 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor) | |||
289 | 289 | ||
290 | debug3("preauth child monitor started"); | 290 | debug3("preauth child monitor started"); |
291 | 291 | ||
292 | close(pmonitor->m_recvfd); | 292 | if (pmonitor->m_recvfd >= 0) |
293 | close(pmonitor->m_log_sendfd); | 293 | close(pmonitor->m_recvfd); |
294 | if (pmonitor->m_log_sendfd >= 0) | ||
295 | close(pmonitor->m_log_sendfd); | ||
294 | pmonitor->m_log_sendfd = pmonitor->m_recvfd = -1; | 296 | pmonitor->m_log_sendfd = pmonitor->m_recvfd = -1; |
295 | 297 | ||
296 | authctxt = _authctxt; | 298 | authctxt = _authctxt; |
@@ -371,8 +373,10 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor) | |||
371 | while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0) | 373 | while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0) |
372 | ; | 374 | ; |
373 | 375 | ||
374 | close(pmonitor->m_sendfd); | 376 | if (pmonitor->m_recvfd >= 0) |
375 | close(pmonitor->m_log_recvfd); | 377 | close(pmonitor->m_recvfd); |
378 | if (pmonitor->m_log_sendfd >= 0) | ||
379 | close(pmonitor->m_log_sendfd); | ||
376 | pmonitor->m_sendfd = pmonitor->m_log_recvfd = -1; | 380 | pmonitor->m_sendfd = pmonitor->m_log_recvfd = -1; |
377 | } | 381 | } |
378 | 382 | ||
diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c index a79c87210..fc7582827 100644 --- a/ssh-pkcs11-client.c +++ b/ssh-pkcs11-client.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-pkcs11-client.c,v 1.7 2017/05/30 08:52:19 markus Exp $ */ | 1 | /* $OpenBSD: ssh-pkcs11-client.c,v 1.8 2018/02/05 05:37:46 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2010 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2010 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -99,7 +99,8 @@ pkcs11_init(int interactive) | |||
99 | void | 99 | void |
100 | pkcs11_terminate(void) | 100 | pkcs11_terminate(void) |
101 | { | 101 | { |
102 | close(fd); | 102 | if (fd >= 0) |
103 | close(fd); | ||
103 | } | 104 | } |
104 | 105 | ||
105 | static int | 106 | static int |