summaryrefslogtreecommitdiff
path: root/src/sysdeps/tryancilautoclose.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysdeps/tryancilautoclose.c')
-rw-r--r--src/sysdeps/tryancilautoclose.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/sysdeps/tryancilautoclose.c b/src/sysdeps/tryancilautoclose.c
index d0a2833..1db7a7a 100644
--- a/src/sysdeps/tryancilautoclose.c
+++ b/src/sysdeps/tryancilautoclose.c
@@ -8,7 +8,7 @@
#endif
#ifndef _XPG4_2
-# define _XPG4_2
+#define _XPG4_2
#endif
#include <sys/types.h>
@@ -17,9 +17,6 @@
#include <errno.h>
#include <sys/socket.h>
#include <sys/uio.h>
-#if defined(__FreeBSD__)
-# include <sys/param.h>
-#endif
static int ancil_send_fd (int sock, int fd)
{
@@ -37,7 +34,7 @@ static int ancil_send_fd (int sock, int fd)
.msg_controllen = sizeof(ancilbuf)
} ;
struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msghdr) ;
- cmsg->cmsg_len = msghdr.msg_controllen ;
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int)) ;
cmsg->cmsg_level = SOL_SOCKET ;
cmsg->cmsg_type = SCM_RIGHTS ;
*((int *)CMSG_DATA(cmsg)) = fd ;