* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <netinet/in.h>
#include <pthread.h>
+/* 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
*/
}
memset (&ss, 0, sizeof (ss));
- memcpy (&ss, addr, alen > sizeof (ss) ? sizeof (ss) : alen);
+ memcpy (&ss, addr, (alen > sizeof (ss)) ? sizeof (ss) : alen);
pthread_mutex_lock (&mutex);
if (send (sock, &ss, sizeof (ss), 0) != sizeof (ss))