[openssh-commits] [openssh] 04/05: upstream commit
git+noreply at mindrot.org
git+noreply at mindrot.org
Wed Feb 7 07:53:45 AEDT 2018
This is an automated email from the git hooks/post-receive script.
dtucker pushed a commit to branch master
in repository openssh.
commit 3484380110d437c50e17f87d18544286328c75cb
Author: tb at openbsd.org <tb at openbsd.org>
Date: Mon Feb 5 05:37:46 2018 +0000
upstream commit
Add a couple of non-negativity checks to avoid close(-1).
ok djm
OpenBSD-Commit-ID: 4701ce0b37161c891c838d0931305f1d37a50880
---
monitor.c | 14 +++++++++-----
ssh-pkcs11-client.c | 5 +++--
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/monitor.c b/monitor.c
index 89c8c958..e4ac3ccf 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
-/* $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 at citi.umich.edu>
* Copyright 2002 Markus Friedl <markus at openbsd.org>
@@ -289,8 +289,10 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
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;
@@ -371,8 +373,10 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
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;
}
diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c
index a79c8721..fc758282 100644
--- a/ssh-pkcs11-client.c
+++ b/ssh-pkcs11-client.c
@@ -1,4 +1,4 @@
-/* $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.
*
@@ -99,7 +99,8 @@ pkcs11_init(int interactive)
void
pkcs11_terminate(void)
{
- close(fd);
+ if (fd >= 0)
+ close(fd);
}
static int
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list