Commit 2193b044 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

rootwrap: work around missing MSG_NOSIGNAL on old BSD derivatives

parent 499145b8
......@@ -44,10 +44,12 @@
# warning Uho, your IPv6 support is broken and has been disabled. Fix your C library.
# undef AF_INET6
#endif
#ifndef AF_LOCAL
# define AF_LOCAL AF_UNIX
#endif
#if !defined(MSG_NOSIGNAL) && defined(SO_NOSIGPIPE)
# define MSG_NOSIGNAL 0
#endif
/* Required yet non-standard cmsg functions */
#ifndef CMSG_ALIGN
# define CMSG_ALIGN(len) (((len) + sizeof(intptr_t)-1) & ~(sizeof(intptr_t)-1))
......
......@@ -57,6 +57,12 @@ int rootwrap_bind (int, int, int, const struct sockaddr *, size_t);
#ifndef CMSG_LEN
# define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
#endif
#if !defined(MSG_NOSIGNAL)
/* If the other end of the pipe hangs up and MSG_NOSIGNAL is missing, the
* process will get a (likely fatal) SIGPIPE signal. Then again, the other end
* can screw us up in various ways already (e.g. not answer to deadlock). */
# define MSG_NOSIGNAL 0
#endif
#if defined(__OS2__) && !defined(ALIGN)
/* CMSG_NXTHDR requires this */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment