From 46eb312f1315ec8798da3a30fcb61f28b2d7fc95 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 8 Jan 2015 13:12:50 +0000 Subject: [PATCH] * include/cygwin/socket.h (struct cmsghdr): Redefine cmsg_len as type size_t. Add comment to explain why. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/include/cygwin/socket.h | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 1a739d5f8..364a2ba31 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2015-01-08 Corinna Vinschen + + * include/cygwin/socket.h (struct cmsghdr): Redefine cmsg_len as type + size_t. Add comment to explain why. + 2015-01-08 Corinna Vinschen * localtime.cc (__cygwin_gettzoffset): New function for access from diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h index 8288c8320..b74ada7eb 100644 --- a/winsup/cygwin/include/cygwin/socket.h +++ b/winsup/cygwin/include/cygwin/socket.h @@ -1,7 +1,7 @@ /* cygwin/socket.h Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009, 2010, 2012, - 2013, 2014 Red Hat, Inc. + 2013, 2014, 2015 Red Hat, Inc. This file is part of Cygwin. @@ -77,7 +77,10 @@ struct msghdr struct cmsghdr { - socklen_t cmsg_len; /* Length of cmsghdr + data */ + /* Amazing but true: The type of cmsg_len should be socklen_t but, just + as on Linux, the definition of the kernel is incompatible with this, + so the Windows socket headers define cmsg_len as SIZE_T. */ + size_t cmsg_len; /* Length of cmsghdr + data */ int cmsg_level; /* Protocol */ int cmsg_type; /* Protocol type */ };