posix.cfg: Improved configuration of recvfrom().

This commit is contained in:
orbitcowboy 2022-05-01 12:24:15 +02:00
parent 85f44d36dd
commit d6af9da83d
2 changed files with 12 additions and 0 deletions

View File

@ -2281,6 +2281,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
<valid>0:</valid> <valid>0:</valid>
</arg> </arg>
<arg nr="2" direction="out"> <arg nr="2" direction="out">
<not-null/>
<minsize type="argvalue" arg="3"/> <minsize type="argvalue" arg="3"/>
</arg> </arg>
<arg nr="3" direction="in"> <arg nr="3" direction="in">

View File

@ -32,6 +32,17 @@
#include <wchar.h> #include <wchar.h>
#include <string.h> #include <string.h>
ssize_t nullPointer_recvfrom(int sockfd, void *buf, size_t len, int flags,
struct sockaddr *src_addr, socklen_t *addrlen)
{
// If src_addr is not NULL, and the underlying protocol provides the source address, this source address is filled in.
(void) recvfrom(sockfd, buf, len, flags, NULL, addrlen);
(void) recvfrom(sockfd, buf, len, flags, src_addr, NULL);
(void) recvfrom(sockfd, buf, len, flags, NULL, NULL);
// cppcheck-suppress nullPointer
(void) recvfrom(sockfd, NULL, len, flags, src_addr, addrlen);
return recvfrom(sockfd, buf, len, flags, src_addr, addrlen);
}
int nullPointer_semop(int semid, struct sembuf *sops, size_t nsops) int nullPointer_semop(int semid, struct sembuf *sops, size_t nsops)
{ {
// cppcheck-suppress nullPointer // cppcheck-suppress nullPointer