[vlc-devel] commit: winsock recvmsg: fix WSARecvFrom usage ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Sep 7 19:48:14 CEST 2008


vlc | branch: 0.9-bugfix | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Sep  7 14:25:40 2008 +0300| [c97538ae57ee3e5df4630536a698d546eaee0238] | committer: Rémi Denis-Courmont 

winsock recvmsg: fix WSARecvFrom usage

Pointed-out-by: Laurent Aimar
(cherry picked from commit 82580b6fabbc12384d59cf8fa9513cd246e3c958)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c97538ae57ee3e5df4630536a698d546eaee0238
---

 src/network/winsock.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/network/winsock.c b/src/network/winsock.c
index ac01bc9..977f62e 100644
--- a/src/network/winsock.c
+++ b/src/network/winsock.c
@@ -185,12 +185,16 @@ ssize_t vlc_recvmsg (int s, struct msghdr *hdr, int flags)
         buf[i].buf = hdr->msg_iov[i].iov_base,
         buf[i].len = hdr->msg_iov[i].iov_len;
 
-    DWORD recvd;
+    DWORD recvd, dwFlags = flags;
+    INT fromlen = hdr->msg_namelen;
     hdr->msg_controllen = 0;
     hdr->msg_flags = 0;
 
-    if (WSARecvFrom (s, buf, sizeof (buf) / sizeof (buf[0]), &recvd, flags,
-                     hdr->msg_name, hdr->msg_namelen, NULL, NULL) == 0)
+    int ret = WSARecvFrom (s, buf, sizeof (buf) / sizeof (buf[0]), &recvd,
+                           &dwFlags, hdr->msg_name, &fromlen, NULL, NULL);
+    hdr->msg_namelen = fromlen;
+    hdr->msg_flags = dwFlags;
+    if (ret == 0)
         return recvd;
 
 #ifdef MSG_TRUNC




More information about the vlc-devel mailing list