Make CMSG_*() work without having NULL available.

The <sys/socket.h> is not supposed to declare NULL, according to POSIX.
Our implementation complies with that, meaning that we need to make sure
that CMSG_*() doesn't use it.
This commit is contained in:
Ed Schouten 2016-05-31 13:32:33 +00:00
parent 3a45c3d643
commit 455ee98d8d

View File

@ -500,7 +500,7 @@ struct sockcred {
/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
#define CMSG_NXTHDR(mhdr, cmsg) \
((char *)(cmsg) == NULL ? CMSG_FIRSTHDR(mhdr) : \
((char *)(cmsg) == (char *)0 ? CMSG_FIRSTHDR(mhdr) : \
((char *)(cmsg) + _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len) + \
_ALIGN(sizeof(struct cmsghdr)) > \
(char *)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \
@ -515,7 +515,7 @@ struct sockcred {
#define CMSG_FIRSTHDR(mhdr) \
((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \
(struct cmsghdr *)(mhdr)->msg_control : \
(struct cmsghdr *)NULL)
(struct cmsghdr *)0)
#if __BSD_VISIBLE
/* RFC 2292 additions */