]> Savannah Git Hosting - gnulib.git/commitdiff
passfd: Fix compilation error on IRIX.
authorBruno Haible <bruno@clisp.org>
Fri, 24 Dec 2021 19:51:37 +0000 (20:51 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 24 Dec 2021 19:51:37 +0000 (20:51 +0100)
* lib/passfd.c (sendfd): On IRIX, ignore CMSG_FIRSTHDR.
(recvfd): Likewise. Produce a fake error ENOTCONN.

ChangeLog
lib/passfd.c

index 5e27c022e95f269144a5a2ff398db8edf1800e65..4cf5222bb5c14bf7b6c1fc5e0d110528c7640ad9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-12-24  Bruno Haible  <bruno@clisp.org>
+
+       passfd: Fix compilation error on IRIX.
+       * lib/passfd.c (sendfd): On IRIX, ignore CMSG_FIRSTHDR.
+       (recvfd): Likewise. Produce a fake error ENOTCONN.
+
 2021-12-24  Bruno Haible  <bruno@clisp.org>
 
        tests: Fix link errors on AIX.
index 8a3b7bd10b4988c5c22d5475726f0dbcbfa68375..e22419a3ce6202aefc229611219d62bd9e606de4 100644 (file)
@@ -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