Bugzilla – Attachment 3401 Details for
Bug 3071
unhandled EINTR while connecting causes ssh to exit prematurely
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
handle EINTR in connect_timeout() and waitfd()
bz3071.diff (text/plain), 980 bytes, created by
Damien Miller
on 2020-05-29 15:16:49 AEST
(
hide
)
Description:
handle EINTR in connect_timeout() and waitfd()
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2020-05-29 15:16:49 AEST
Size:
980 bytes
patch
obsolete
>diff --git a/misc.c b/misc.c >index 5a34107f..7fbd5a02 100644 >--- a/misc.c >+++ b/misc.c >@@ -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;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dtucker
:
ok+
Actions:
View
|
Diff
Attachments on
bug 3071
:
3329
| 3401