-/* $OpenBSD: monitor.c,v 1.178 2018/01/23 05:27:21 djm Exp $ */
+/* $OpenBSD: monitor.c,v 1.179 2018/02/05 05:37:46 tb Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2002 Markus Friedl <markus@openbsd.org>
debug3("preauth child monitor started");
- close(pmonitor->m_recvfd);
- close(pmonitor->m_log_sendfd);
+ if (pmonitor->m_recvfd >= 0)
+ close(pmonitor->m_recvfd);
+ if (pmonitor->m_log_sendfd >= 0)
+ close(pmonitor->m_log_sendfd);
pmonitor->m_log_sendfd = pmonitor->m_recvfd = -1;
authctxt = _authctxt;
while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0)
;
- close(pmonitor->m_sendfd);
- close(pmonitor->m_log_recvfd);
+ if (pmonitor->m_recvfd >= 0)
+ close(pmonitor->m_recvfd);
+ if (pmonitor->m_log_sendfd >= 0)
+ close(pmonitor->m_log_sendfd);
pmonitor->m_sendfd = pmonitor->m_log_recvfd = -1;
}
-/* $OpenBSD: ssh-pkcs11-client.c,v 1.7 2017/05/30 08:52:19 markus Exp $ */
+/* $OpenBSD: ssh-pkcs11-client.c,v 1.8 2018/02/05 05:37:46 tb Exp $ */
/*
* Copyright (c) 2010 Markus Friedl. All rights reserved.
*
void
pkcs11_terminate(void)
{
- close(fd);
+ if (fd >= 0)
+ close(fd);
}
static int