From 86165a8f8faf913059429476adab999e9031640a Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 24 Dec 2021 20:51:37 +0100 Subject: passfd: Fix compilation error on IRIX. * lib/passfd.c (sendfd): On IRIX, ignore CMSG_FIRSTHDR. (recvfd): Likewise. Produce a fake error ENOTCONN. --- lib/passfd.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/passfd.c b/lib/passfd.c index 8a3b7bd10b..e22419a3ce 100644 --- a/lib/passfd.c +++ b/lib/passfd.c @@ -52,7 +52,7 @@ sendfd (int sock, int fd) char byte = 0; struct iovec iov; struct msghdr msg; -# ifdef CMSG_FIRSTHDR +# if defined CMSG_FIRSTHDR && !defined __sgi struct cmsghdr *cmsg; char buf[CMSG_SPACE (sizeof fd)]; # endif @@ -66,7 +66,7 @@ sendfd (int sock, int fd) msg.msg_name = NULL; msg.msg_namelen = 0; -# ifdef CMSG_FIRSTHDR +# if defined CMSG_FIRSTHDR && !defined __sgi msg.msg_control = buf; msg.msg_controllen = sizeof buf; cmsg = CMSG_FIRSTHDR (&msg); @@ -112,7 +112,7 @@ recvfd (int sock, int flags) struct msghdr msg; int fd = -1; ssize_t len; -# ifdef CMSG_FIRSTHDR +# if defined CMSG_FIRSTHDR && !defined __sgi struct cmsghdr *cmsg; char buf[CMSG_SPACE (sizeof fd)]; int flags_recvmsg = flags & O_CLOEXEC ? MSG_CMSG_CLOEXEC : 0; @@ -133,7 +133,7 @@ recvfd (int sock, int flags) msg.msg_name = NULL; msg.msg_namelen = 0; -# ifdef CMSG_FIRSTHDR +# if defined CMSG_FIRSTHDR && !defined __sgi msg.msg_control = buf; msg.msg_controllen = sizeof buf; cmsg = CMSG_FIRSTHDR (&msg); @@ -193,6 +193,9 @@ recvfd (int sock, int flags) return -1; } } + + if (fd < 0 && errno == 0) + errno = ENOTCONN; # else errno = ENOSYS; # endif -- cgit v1.2.1