error handling recvfrom(2)
From: Peter Radisson <hidden>
Date: 2025-03-27 11:45:26
Hi list,
I noted the error handling in recvfrom(2) is wired.
note i will only talk about src_addr and addrlen in the case
src_addr != NULL. I have tested with kernel 5.14.
Function: the kernel shall fill the user supplied structure in src_addr
what should be addrlen in size (should be sizeof struct sockaddr ).
regarding addrlen i found the follwing behavier:
addrlen < 0 errno=EINVAL
0<= addrlen < sizeof struct sockaddr no errno set
IMHO recvfrom(2) should report an error here also.
while testing i noted that the case addrlen < 0 is checked
after the call. What means if you use a blocking recvfrom,
the call waits for an answer only to report an error afterwards.
IMHO the check for space should be done before.
What is the rationale behind this ?
If not can that be changed ?
note: please reply directly i am not a list member
note: I send also a mail to the man-page list to improve the
documentation of the current state
CU