summaryrefslogtreecommitdiff
path: root/x11/rxvt-unicode
diff options
context:
space:
mode:
authorsnj <snj@pkgsrc.org>2009-05-19 19:41:18 +0000
committersnj <snj@pkgsrc.org>2009-05-19 19:41:18 +0000
commitbf66fea382713d2e65cdb7a4d9ce6b925d4d2a0f (patch)
tree8c0834812bfac3c0b27d9ad0c17684824621e360 /x11/rxvt-unicode
parent0f26c0ef834039c968e179ea0967819fb1c7859a (diff)
downloadpkgsrc-bf66fea382713d2e65cdb7a4d9ce6b925d4d2a0f.tar.gz
Add the upstream version of a patch submitted by Talor R Campbell in
PR pkg/38988 to fix a problem with socket control message ancillary data alignment. Bump PKGREVISION to 1.
Diffstat (limited to 'x11/rxvt-unicode')
-rw-r--r--x11/rxvt-unicode/Makefile3
-rw-r--r--x11/rxvt-unicode/distinfo3
-rw-r--r--x11/rxvt-unicode/patches/patch-ad120
3 files changed, 124 insertions, 2 deletions
diff --git a/x11/rxvt-unicode/Makefile b/x11/rxvt-unicode/Makefile
index 454a3ab645b..165a0c7a057 100644
--- a/x11/rxvt-unicode/Makefile
+++ b/x11/rxvt-unicode/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.25 2009/05/19 07:00:36 abs Exp $
+# $NetBSD: Makefile,v 1.26 2009/05/19 19:41:18 snj Exp $
DISTNAME= rxvt-unicode-9.06
+PKGREVISION= 1
CATEGORIES= x11
MASTER_SITES= http://dist.schmorp.de/rxvt-unicode/ \
http://dist.schmorp.de/rxvt-unicode/Attic/
diff --git a/x11/rxvt-unicode/distinfo b/x11/rxvt-unicode/distinfo
index a52f2ec86d2..61b40223cb8 100644
--- a/x11/rxvt-unicode/distinfo
+++ b/x11/rxvt-unicode/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.12 2009/03/06 00:20:27 snj Exp $
+$NetBSD: distinfo,v 1.13 2009/05/19 19:41:19 snj Exp $
SHA1 (rxvt-unicode-9.06.tar.bz2) = df623ebdad001de534781721f8298ba1add0df2c
RMD160 (rxvt-unicode-9.06.tar.bz2) = ae737ed07e943303318bd81b566146d5426f36bd
@@ -6,3 +6,4 @@ Size (rxvt-unicode-9.06.tar.bz2) = 869076 bytes
SHA1 (patch-aa) = 2d93a4717f7f3a0e833a5b13a8b6c4f9301b7680
SHA1 (patch-ab) = f711bd5046fd9523b88b7a73ab9981a3bb7172fb
SHA1 (patch-ac) = 22c2e28a5b0ece42fbdbbafa85a8cec80f1d8277
+SHA1 (patch-ad) = ac5e3b32b9668288a71c091f6b30fcfc4e3ef5ab
diff --git a/x11/rxvt-unicode/patches/patch-ad b/x11/rxvt-unicode/patches/patch-ad
new file mode 100644
index 00000000000..8fb20b65da9
--- /dev/null
+++ b/x11/rxvt-unicode/patches/patch-ad
@@ -0,0 +1,120 @@
+$NetBSD: patch-ad,v 1.1 2009/05/19 19:41:19 snj Exp $
+
+--- src/fdpass.C.orig 2008-05-05 09:51:47.000000000 -0700
++++ src/fdpass.C 2009-05-19 12:28:03.000000000 -0700
+@@ -26,6 +26,7 @@
+ #include "../config.h"
+
+ #include <cstddef> // needed by broken bsds for NULL used in sys/uio.h
++#include <cstdlib>
+
+ #include <sys/types.h>
+ #include <sys/uio.h>
+@@ -33,16 +34,26 @@
+
+ #include "libptytty.h"
+
+-#ifndef CMSG_LEN // CMSG_SPACE && CMSG_LEN are rfc2292 extensions to unix
++// CMSG_SPACE & CMSG_LEN are rfc2292 extensions to unix
++#ifndef CMSG_SPACE
++# define CMSG_SPACE(len) (sizeof (cmsghdr) + len)
++#endif
++
++#ifndef CMSG_LEN
+ # define CMSG_LEN(len) (sizeof (cmsghdr) + len)
+ #endif
+
+ bool
+ ptytty::send_fd (int socket, int fd)
+ {
++ void *buf = malloc (CMSG_SPACE (sizeof (int)));
++
++ if (!buf)
++ return 0;
++
+ msghdr msg;
+ iovec iov;
+- char buf [CMSG_LEN (sizeof (int))];
++ cmsghdr *cmsg;
+ char data = 0;
+
+ iov.iov_base = &data;
+@@ -52,27 +63,33 @@ ptytty::send_fd (int socket, int fd)
+ msg.msg_namelen = 0;
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+- msg.msg_control = (void *)buf;
+- msg.msg_controllen = sizeof buf;
++ msg.msg_control = buf;
++ msg.msg_controllen = CMSG_SPACE (sizeof (int));
+
+- cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);
++ cmsg = CMSG_FIRSTHDR (&msg);
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+ cmsg->cmsg_len = CMSG_LEN (sizeof (int));
+
+ *(int *)CMSG_DATA (cmsg) = fd;
+
+- msg.msg_controllen = cmsg->cmsg_len;
++ ssize_t result = sendmsg (socket, &msg, 0);
++
++ free (buf);
+
+- return sendmsg (socket, &msg, 0) >= 0;
++ return result >= 0;
+ }
+
+ int
+ ptytty::recv_fd (int socket)
+ {
++ void *buf = malloc (CMSG_SPACE (sizeof (int)));
++
++ if (!buf)
++ return -1;
++
+ msghdr msg;
+ iovec iov;
+- char buf [CMSG_LEN (sizeof (int))]; /* ancillary data buffer */
+ char data = 1;
+
+ iov.iov_base = &data;
+@@ -83,23 +100,24 @@ ptytty::recv_fd (int socket)
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+ msg.msg_control = buf;
+- msg.msg_controllen = sizeof buf;
++ msg.msg_controllen = CMSG_SPACE (sizeof (int));
+
+- cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);
+- cmsg->cmsg_level = SOL_SOCKET;
+- cmsg->cmsg_type = SCM_RIGHTS;
+- cmsg->cmsg_len = CMSG_LEN (sizeof (int));
++ int fd = -1;
+
+- msg.msg_controllen = cmsg->cmsg_len;
++ if (recvmsg (socket, &msg, 0) > 0
++ && data == 0
++ && msg.msg_controllen >= CMSG_SPACE (sizeof (int)))
++ {
++ cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);
+
+- if (recvmsg (socket, &msg, 0) <= 0
+- || data != 0
+- || msg.msg_controllen < CMSG_LEN (sizeof (int))
+- || cmsg->cmsg_level != SOL_SOCKET
+- || cmsg->cmsg_type != SCM_RIGHTS
+- || cmsg->cmsg_len < CMSG_LEN (sizeof (int)))
+- return -1;
++ if (cmsg->cmsg_level == SOL_SOCKET
++ && cmsg->cmsg_type == SCM_RIGHTS
++ && cmsg->cmsg_len >= CMSG_LEN (sizeof (int)))
++ fd = *(int *)CMSG_DATA (cmsg);
++ }
++
++ free (buf);
+
+- return *(int *)CMSG_DATA (cmsg);
++ return fd;
+ }
+