Module: wine Branch: master Commit: 6db935a6f45391c82437c0892a077b30338f5e52 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6db935a6f45391c82437c0892a...
Author: Bruno Jesus 00cpxxx@gmail.com Date: Sun Jun 15 21:16:25 2014 -0300
winhttp: Use a helper to send data and take care of EINTR.
---
dlls/winhttp/net.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/dlls/winhttp/net.c b/dlls/winhttp/net.c index b751bf0..c7ff035 100644 --- a/dlls/winhttp/net.c +++ b/dlls/winhttp/net.c @@ -139,6 +139,17 @@ static int sock_get_error( int err ) return err; }
+static int sock_send(int fd, const void *msg, size_t len, int flags) +{ + int ret; + do + { + ret = send(fd, msg, len, flags); + } + while(ret == -1 && errno == EINTR); + return ret; +} + static DWORD netconn_verify_cert( PCCERT_CONTEXT cert, WCHAR *server, DWORD security_flags ) { HCERTSTORE store = cert->hCertStore; @@ -403,7 +414,7 @@ BOOL netconn_secure_connect( netconn_t *conn, WCHAR *hostname )
TRACE("sending %u bytes\n", out_buf.cbBuffer);
- size = send(conn->socket, out_buf.pvBuffer, out_buf.cbBuffer, 0); + size = sock_send(conn->socket, out_buf.pvBuffer, out_buf.cbBuffer, 0); if(size != out_buf.cbBuffer) { ERR("send failed\n"); res = ERROR_WINHTTP_SECURE_CHANNEL_ERROR; @@ -524,7 +535,7 @@ static BOOL send_ssl_chunk(netconn_t *conn, const void *msg, size_t size) return FALSE; }
- if(send(conn->socket, conn->ssl_buf, bufs[0].cbBuffer+bufs[1].cbBuffer+bufs[2].cbBuffer, 0) < 1) { + if(sock_send(conn->socket, conn->ssl_buf, bufs[0].cbBuffer+bufs[1].cbBuffer+bufs[2].cbBuffer, 0) < 1) { WARN("send failed\n"); return FALSE; } @@ -554,7 +565,7 @@ BOOL netconn_send( netconn_t *conn, const void *msg, size_t len, int *sent )
return TRUE; } - if ((*sent = send( conn->socket, msg, len, 0 )) == -1) + if ((*sent = sock_send( conn->socket, msg, len, 0 )) == -1) { set_last_error( sock_get_error( errno ) ); return FALSE;