diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2022-05-25 20:29:04 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2022-05-25 20:29:04 +0000 |
commit | d60ea9a10a79b45491cd965b6006aadf29badcf9 (patch) | |
tree | 82f34342f2d79417882701a18a41013a7065f9c2 | |
parent | 23402c83f4fc2db45f0435ed106791828a6522df (diff) | |
download | src-d60ea9a10a79b45491cd965b6006aadf29badcf9.tar.gz src-d60ea9a10a79b45491cd965b6006aadf29badcf9.zip |
sockets: return EMSGSIZE if control part of message is too large
Specification doesn't list an explicit error code for the control
size specified by msg_control being too large. But it does list
EMSGSIZE as error code for "message is too large to be sent all at
once (as the socket requires)". It also lists EINVAL as code for
the "The sum of the iov_len values overflows an ssize_t." Given
how generic and uninformative EINVAL is, the EMSGSIZE is more
appropriate.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendmsg.html
Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D35316
-rw-r--r-- | sys/kern/uipc_syscalls.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 72336d31071c..fef5dce796d2 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1521,7 +1521,7 @@ sockargs(struct mbuf **mp, char *buf, socklen_t buflen, int type) else #endif if (buflen > MCLBYTES) - return (EINVAL); + return (EMSGSIZE); } m = m_get2(buflen, M_WAITOK, type, 0); m->m_len = buflen; |