pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/x11/rxvt-unicode Add the upstream version of a patch s...
details: https://anonhg.NetBSD.org/pkgsrc/rev/fc6ceb181bb5
branches: trunk
changeset: 393329:fc6ceb181bb5
user: snj <snj%pkgsrc.org@localhost>
date: Tue May 19 19:41:18 2009 +0000
description:
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:
x11/rxvt-unicode/Makefile | 3 +-
x11/rxvt-unicode/distinfo | 3 +-
x11/rxvt-unicode/patches/patch-ad | 120 ++++++++++++++++++++++++++++++++++++++
3 files changed, 124 insertions(+), 2 deletions(-)
diffs (150 lines):
diff -r cd20d73ffdf2 -r fc6ceb181bb5 x11/rxvt-unicode/Makefile
--- a/x11/rxvt-unicode/Makefile Tue May 19 18:56:55 2009 +0000
+++ b/x11/rxvt-unicode/Makefile Tue May 19 19:41:18 2009 +0000
@@ -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 -r cd20d73ffdf2 -r fc6ceb181bb5 x11/rxvt-unicode/distinfo
--- a/x11/rxvt-unicode/distinfo Tue May 19 18:56:55 2009 +0000
+++ b/x11/rxvt-unicode/distinfo Tue May 19 19:41:18 2009 +0000
@@ -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 @@
SHA1 (patch-aa) = 2d93a4717f7f3a0e833a5b13a8b6c4f9301b7680
SHA1 (patch-ab) = f711bd5046fd9523b88b7a73ab9981a3bb7172fb
SHA1 (patch-ac) = 22c2e28a5b0ece42fbdbbafa85a8cec80f1d8277
+SHA1 (patch-ad) = ac5e3b32b9668288a71c091f6b30fcfc4e3ef5ab
diff -r cd20d73ffdf2 -r fc6ceb181bb5 x11/rxvt-unicode/patches/patch-ad
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/x11/rxvt-unicode/patches/patch-ad Tue May 19 19:41:18 2009 +0000
@@ -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;
+ }
+
Home |
Main Index |
Thread Index |
Old Index