[openssh-commits] [openssh] 13/15: upstream: handle EINTR in waitfd() and timeout_connect() helpers;
git+noreply at mindrot.org
git+noreply at mindrot.org
Fri Jun 26 15:26:16 AEST 2020
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 3d06ff4bbd3dca8054c238d2a94c0da563ef7eee
Author: djm at openbsd.org <djm at openbsd.org>
Date: Fri Jun 26 05:16:38 2020 +0000
upstream: handle EINTR in waitfd() and timeout_connect() helpers;
bz#3071; ok dtucker@
OpenBSD-Commit-ID: 08fa87be50070bd8b754d9b1ebb1138d7bc9d8ee
---
misc.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/misc.c b/misc.c
index f29e9bc3..4623b575 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.152 2020/05/29 11:17:56 dtucker Exp $ */
+/* $OpenBSD: misc.c,v 1.153 2020/06/26 05:16:38 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
@@ -253,7 +253,7 @@ waitfd(int fd, int *timeoutp, short events)
errno = oerrno;
if (r > 0)
return 0;
- else if (r == -1 && errno != EAGAIN)
+ else if (r == -1 && errno != EAGAIN && errno != EINTR)
return -1;
else if (r == 0)
break;
@@ -292,12 +292,17 @@ timeout_connect(int sockfd, const struct sockaddr *serv_addr,
return connect(sockfd, serv_addr, addrlen);
set_nonblock(sockfd);
- if (connect(sockfd, serv_addr, addrlen) == 0) {
- /* Succeeded already? */
- unset_nonblock(sockfd);
- return 0;
- } else if (errno != EINPROGRESS)
- return -1;
+ for (;;) {
+ if (connect(sockfd, serv_addr, addrlen) == 0) {
+ /* Succeeded already? */
+ unset_nonblock(sockfd);
+ return 0;
+ } else if (errno == EINTR)
+ continue;
+ else if (errno != EINPROGRESS)
+ return -1;
+ break;
+ }
if (waitfd(sockfd, timeoutp, POLLIN | POLLOUT) == -1)
return -1;
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list