From 9dd13ebf18681e4ff58af0b52325d12aa1c23d90 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Thu, 9 Oct 2008 20:49:49 +0300 Subject: [PATCH] Provide replacement for CMSG_LEN and CMSG_SPACE --- bin/rootwrap.c | 10 ++++++++++ src/network/rootbind.c | 11 +++++++++++ 2 files changed, 21 insertions(+) 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 */ -- 2.39.2