Cygwin: AF_UNIX: sendmsg, recvmsg: fail if there's a pending error

And set the errno to the pending error number.  See Stevens, UNIX
Network Programming, discussion of select.
This commit is contained in:
Ken Brown 2021-04-09 17:57:15 -04:00
parent 266a70c09f
commit 82c65349c2
1 changed files with 16 additions and 0 deletions

View File

@ -2431,6 +2431,7 @@ fhandler_socket_unix::recvmsg (struct msghdr *msg, int flags)
bool waitall = false;
bool disconnect = false;
bool name_read = false;
int err;
__try
{
@ -2440,6 +2441,13 @@ fhandler_socket_unix::recvmsg (struct msghdr *msg, int flags)
set_errno (EOPNOTSUPP);
__leave;
}
/* FIXME: Check this. It's from Stevens, UNIX Network
Programming, discussion of select. */
if ((err = so_error ()))
{
set_errno (err);
__leave;
}
if (!(evt = create_event ()))
__leave;
@ -3156,6 +3164,7 @@ fhandler_socket_unix::sendmsg (const struct msghdr *msg, int flags)
HANDLE ph = NULL;
HANDLE evt = NULL;
af_unix_pkt_hdr_t *packet;
int err;
__try
{
@ -3165,6 +3174,13 @@ fhandler_socket_unix::sendmsg (const struct msghdr *msg, int flags)
set_errno (EOPNOTSUPP);
__leave;
}
/* FIXME: Check this. It's from Stevens, UNIX Network
Programming, discussion of select. */
if ((err = so_error ()))
{
set_errno (err);
__leave;
}
if (get_socket_type () == SOCK_STREAM)
{
if (msg->msg_namelen)