[vlc-commits] [Git][videolan/vlc][3.0.x] compat: add missing errno on Winsock errors
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sat Sep 7 19:06:25 UTC 2024
Felix Paul Kühne pushed to branch 3.0.x at VideoLAN / VLC
Commits:
2a9a5471 by Steve Lhomme at 2024-09-07T18:42:03+00:00
compat: add missing errno on Winsock errors
Some of the error codes [1] correspond to errno values [2]
[1] https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2
[2] https://docs.microsoft.com/en-us/cpp/c-runtime-library/errno-constants
(cherry picked from commit ddcc2cdcff84e6a83a4dfe581fddde6f524877aa)
- - - - -
2 changed files:
- compat/recvmsg.c
- compat/sendmsg.c
Changes:
=====================================
compat/recvmsg.c
=====================================
@@ -74,11 +74,51 @@ ssize_t recvmsg(int fd, struct msghdr *msg, int flags)
return rcvd;
}
- switch (WSAGetLastError())
+ int err = WSAGetLastError();
+ switch (err)
{
case WSAEWOULDBLOCK:
errno = EAGAIN;
break;
+ case WSA_NOT_ENOUGH_MEMORY:
+ errno = ENOMEM;
+ break;
+ case WSAEAFNOSUPPORT:
+ errno = EAFNOSUPPORT;
+ break;
+ case WSAENOBUFS:
+ errno = ENOBUFS;
+ break;
+ case WSAEINPROGRESS:
+ errno = EINPROGRESS;
+ break;
+ case WSAEINTR:
+ errno = EINTR;
+ break;
+ case WSAEBADF:
+ errno = EBADF;
+ break;
+ case WSAEACCES:
+ errno = EACCES;
+ break;
+ case WSAEFAULT:
+ errno = EFAULT;
+ break;
+ case WSAEINVAL:
+ errno = EINVAL;
+ break;
+ case WSAEMFILE:
+ errno = EMFILE;
+ break;
+ case WSAEALREADY:
+ errno = EALREADY;
+ break;
+ case WSAECONNRESET:
+ errno = ECONNRESET;
+ break;
+ default:
+ errno = err;
+ break;
}
return -1;
}
=====================================
compat/sendmsg.c
=====================================
@@ -64,11 +64,51 @@ ssize_t sendmsg(int fd, const struct msghdr *msg, int flags)
if (ret == 0)
return sent;
- switch (WSAGetLastError())
+ int err = WSAGetLastError();
+ switch (err)
{
case WSAEWOULDBLOCK:
errno = EAGAIN;
break;
+ case WSA_NOT_ENOUGH_MEMORY:
+ errno = ENOMEM;
+ break;
+ case WSAEAFNOSUPPORT:
+ errno = EAFNOSUPPORT;
+ break;
+ case WSAENOBUFS:
+ errno = ENOBUFS;
+ break;
+ case WSAEINPROGRESS:
+ errno = EINPROGRESS;
+ break;
+ case WSAEINTR:
+ errno = EINTR;
+ break;
+ case WSAEBADF:
+ errno = EBADF;
+ break;
+ case WSAEACCES:
+ errno = EACCES;
+ break;
+ case WSAEFAULT:
+ errno = EFAULT;
+ break;
+ case WSAEINVAL:
+ errno = EINVAL;
+ break;
+ case WSAEMFILE:
+ errno = EMFILE;
+ break;
+ case WSAEALREADY:
+ errno = EALREADY;
+ break;
+ case WSAECONNRESET:
+ errno = ECONNRESET;
+ break;
+ default:
+ errno = err;
+ break;
}
return -1;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2a9a547142db54cd3f5af6fa9caafc87ba06f66a
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2a9a547142db54cd3f5af6fa9caafc87ba06f66a
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