summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-12-24 20:51:37 +0100
committerBruno Haible <bruno@clisp.org>2021-12-24 20:51:37 +0100
commit86165a8f8faf913059429476adab999e9031640a (patch)
tree34476da81553b85de49527a57473f604585332ab /lib
parentfd03b5cc0e0417251da917805d7c4bd02856fe47 (diff)
downloadgnulib-86165a8f8faf913059429476adab999e9031640a.tar.gz
passfd: Fix compilation error on IRIX.
* lib/passfd.c (sendfd): On IRIX, ignore CMSG_FIRSTHDR. (recvfd): Likewise. Produce a fake error ENOTCONN.
Diffstat (limited to 'lib')
-rw-r--r--lib/passfd.c11
1 files changed, 7 insertions, 4 deletions
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