From: RĂ©mi Denis-Courmont Date: Thu, 9 Oct 2008 17:49:49 +0000 (+0300) Subject: Provide replacement for CMSG_LEN and CMSG_SPACE X-Git-Tag: 1.0.0-pre1~2605 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=9dd13ebf18681e4ff58af0b52325d12aa1c23d90;p=vlc Provide replacement for CMSG_LEN and CMSG_SPACE --- diff --git a/bin/rootwrap.c b/bin/rootwrap.c index f2c851a354..cff9476b5d 100644 --- a/bin/rootwrap.c +++ b/bin/rootwrap.c @@ -45,6 +45,16 @@ #ifndef AF_LOCAL # define AF_LOCAL AF_UNIX #endif +/* Required yet non-standard cmsg functions */ +#ifndef CMSG_ALIGN +# define CMSG_ALIGN(len) (((len) + sizeof(intptr_t)-1) & ~(sizeof(intptr_t)-1)) +#endif +#ifndef CMSG_SPACE +# define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) +#endif +#ifndef CMSG_LEN +# define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) +#endif static inline int is_allowed_port (uint16_t port) { diff --git a/src/network/rootbind.c b/src/network/rootbind.c index dfdf6241f9..b9c94b55ea 100644 --- a/src/network/rootbind.c +++ b/src/network/rootbind.c @@ -45,6 +45,17 @@ int rootwrap_bind (int, int, int, const struct sockaddr *, size_t); #include #include +/* Required yet non-standard cmsg functions */ +#ifndef CMSG_ALIGN +# define CMSG_ALIGN(len) (((len) + sizeof(intptr_t)-1) & ~(sizeof(intptr_t)-1)) +#endif +#ifndef CMSG_SPACE +# define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len)) +#endif +#ifndef CMSG_LEN +# define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len)) +#endif + /** * Receive a file descriptor from another process */