soreceive_stream: correctly handle edge cases
- non NULL controlp is not an error, returning EINVAL would cause X forwarding to fail - MSG_PEEK and MSG_WAITALL are fairly exceptional, but we still want to handle them - punt to soreceive_generic
This commit is contained in:
parent
a9336cef39
commit
c34bf30069
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334960
@ -2162,7 +2162,6 @@ soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio,
|
||||
|
||||
/*
|
||||
* Optimized version of soreceive() for stream (TCP) sockets.
|
||||
* XXXAO: (MSG_WAITALL | MSG_PEEK) isn't properly handled.
|
||||
*/
|
||||
int
|
||||
soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio,
|
||||
@ -2177,12 +2176,14 @@ soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio,
|
||||
return (EINVAL);
|
||||
if (psa != NULL)
|
||||
*psa = NULL;
|
||||
if (controlp != NULL)
|
||||
return (EINVAL);
|
||||
if (flagsp != NULL)
|
||||
flags = *flagsp &~ MSG_EOR;
|
||||
else
|
||||
flags = 0;
|
||||
if (flags & (MSG_PEEK|MSG_WAITALL))
|
||||
return (soreceive_generic(so, psa, uio, mp0, controlp, flagsp));
|
||||
if (controlp != NULL)
|
||||
*controlp = NULL;
|
||||
if (flags & MSG_OOB)
|
||||
return (soreceive_rcvoob(so, uio, flags));
|
||||
if (mp0 != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user