summaryrefslogtreecommitdiff
path: root/src/libunixonacid
diff options
context:
space:
mode:
Diffstat (limited to 'src/libunixonacid')
-rw-r--r--src/libunixonacid/unixmessage_receive.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/libunixonacid/unixmessage_receive.c b/src/libunixonacid/unixmessage_receive.c
index a86ae10..502b523 100644
--- a/src/libunixonacid/unixmessage_receive.c
+++ b/src/libunixonacid/unixmessage_receive.c
@@ -1,6 +1,5 @@
/* ISC license. */
-#define _XPG4_2
#include <skalibs/sysdeps.h>
#include <skalibs/nonposix.h>
#include <errno.h>
@@ -15,6 +14,20 @@
#include <skalibs/siovec.h>
#include <skalibs/unixmessage.h>
+#ifdef SKALIBS_HASOKWAITALL
+# ifdef SKALIBS_HASCMSGCLOEXEC
+# define RECV(fd, hdr) recvmsg(fd, (hdr), MSG_WAITALL | MSG_CMSG_CLOEXEC)
+# else
+# define RECV(fd, hdr) recvmsg(fd, (hdr), MSG_WAITALL)
+# endif
+#else
+# ifdef SKALIBS_HASCMSGCLOEXEC
+# define RECV(fd, hdr) recvmsg(fd, (hdr), MSG_CMSG_CLOEXEC)
+# else
+# define RECV(fd, hdr) recvmsg(fd, (hdr), 0)
+# endif
+#endif
+
static int unixmessage_receiver_fill (unixmessage_receiver_t *b)
{
char ancilbuf[CMSG_SPACE(b->auxb.a - 1)] ;
@@ -38,11 +51,7 @@ static int unixmessage_receiver_fill (unixmessage_receiver_t *b)
cbuffer_wpeek(&b->mainb, v) ;
iovec_from_siovec(iov, v, 2) ;
}
-#ifdef SKALIBS_HASCMSGCLOEXEC
- r = recvmsg(b->fd, &msghdr, MSG_WAITALL | MSG_CMSG_CLOEXEC) ;
-#else
- r = recvmsg(b->fd, &msghdr, MSG_WAITALL) ;
-#endif
+ r = RECV(b->fd, &msghdr) ;
if (r <= 0) return r ;
{
struct cmsghdr *c = CMSG_FIRSTHDR(&msghdr) ;