[vlc-commits] [Git][videolan/vlc][master] 2 commits: win32: filesystem: always set errno to EAGAIN when accept returns WSAEWOULDBLOCK

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sat Aug 20 16:07:40 UTC 2022



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
b2993735 by Steve Lhomme at 2022-08-20T15:56:11+00:00
win32: filesystem: always set errno to EAGAIN when accept returns WSAEWOULDBLOCK

It done in vlc_accept_i11e() but can be done in all cases.

- - - - -
490c04ad by Steve Lhomme at 2022-08-20T15:56:11+00:00
core: interrupt: make vlc_accept_i11e() platform independent

After removing the WSAEWOULDBLOCK check from the Windows implementation, now
that it's done in vlc_accept(). Both implementation are strictly the same.

- - - - -


2 changed files:

- src/misc/interrupt.c
- src/win32/filesystem.c


Changes:

=====================================
src/misc/interrupt.c
=====================================
@@ -589,14 +589,6 @@ ssize_t vlc_sendto_i11e(int fd, const void *buf, size_t len, int flags,
     return vlc_sendmsg_i11e(fd, &msg, flags);
 }
 
-int vlc_accept_i11e(int fd, struct sockaddr *addr, socklen_t *addrlen,
-                  bool nonblock)
-{
-    if (vlc_poll_sock(fd, POLLIN) < 0)
-        return -1;
-    return vlc_accept(fd, addr, addrlen, nonblock);
-}
-
 #else /* _WIN32 */
 
 ssize_t vlc_recvfrom_i11e(int fd, void *buf, size_t len, int flags,
@@ -623,16 +615,13 @@ ssize_t vlc_sendto_i11e(int fd, const void *buf, size_t len, int flags,
     return ret;
 }
 
+#endif
+
 int vlc_accept_i11e(int fd, struct sockaddr *addr, socklen_t *addrlen,
                   bool nonblock)
 {
     if (vlc_poll_sock(fd, POLLIN) < 0)
         return -1;
-
-    int cfd = vlc_accept(fd, addr, addrlen, nonblock);
-    if (cfd < 0 && WSAGetLastError() == WSAEWOULDBLOCK)
-        errno = EAGAIN;
-    return cfd;
+    return vlc_accept(fd, addr, addrlen, nonblock);
 }
 
-#endif


=====================================
src/win32/filesystem.c
=====================================
@@ -462,6 +462,8 @@ int vlc_accept (int lfd, struct sockaddr *addr, socklen_t *alen, bool nonblock)
     int fd = accept (lfd, addr, alen);
     if (fd != -1 && nonblock)
         ioctlsocket (fd, FIONBIO, &(unsigned long){ 1 });
+    else if (fd < 0 && WSAGetLastError() == WSAEWOULDBLOCK)
+        errno = EAGAIN;
     return fd;
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d93353a9df7ee29b9d914d6a115e24ae8d3e1d77...490c04ad03a9626038444b5c594dfcbcbadeca51

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d93353a9df7ee29b9d914d6a115e24ae8d3e1d77...490c04ad03a9626038444b5c594dfcbcbadeca51
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list