Date: Tue, 31 May 2016 13:32:33 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301038 - head/sys/sys Message-ID: <201605311332.u4VDWXAo028939@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Tue May 31 13:32:33 2016 New Revision: 301038 URL: https://svnweb.freebsd.org/changeset/base/301038 Log: 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. Modified: head/sys/sys/socket.h Modified: head/sys/sys/socket.h ============================================================================== --- head/sys/sys/socket.h Tue May 31 13:31:19 2016 (r301037) +++ head/sys/sys/socket.h Tue May 31 13:32:33 2016 (r301038) @@ -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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605311332.u4VDWXAo028939>