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 */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to