diff options
author | mycroft <mycroft@pkgsrc.org> | 2000-11-11 02:07:57 +0000 |
---|---|---|
committer | mycroft <mycroft@pkgsrc.org> | 2000-11-11 02:07:57 +0000 |
commit | b525469aae8ce4bbac1c9f33ab6413c0a3657a3b (patch) | |
tree | f19e3e6b794a1eebeaf4862be3b3aa5752336f9a /x11/gnome-libs/patches | |
parent | 489fdc67e42cae6897752d990239a5aa94478313 (diff) | |
download | pkgsrc-b525469aae8ce4bbac1c9f33ab6413c0a3657a3b.tar.gz |
Fix file descriptor passing in zvt, as per regress/sys/kern/unfdpass.
This makes gnome-terminal actually work on PowerPC...
Diffstat (limited to 'x11/gnome-libs/patches')
-rw-r--r-- | x11/gnome-libs/patches/patch-ap | 55 | ||||
-rw-r--r-- | x11/gnome-libs/patches/patch-aq | 54 |
2 files changed, 109 insertions, 0 deletions
diff --git a/x11/gnome-libs/patches/patch-ap b/x11/gnome-libs/patches/patch-ap new file mode 100644 index 00000000000..58604dafdaa --- /dev/null +++ b/x11/gnome-libs/patches/patch-ap @@ -0,0 +1,55 @@ +$NetBSD: patch-ap,v 1.1 2000/11/11 02:07:57 mycroft Exp $ + +--- zvt/subshell.c.orig Sat Nov 11 01:59:48 2000 ++++ zvt/subshell.c Sat Nov 11 01:59:11 2000 +@@ -101,32 +101,43 @@ + #endif + #endif /* CMSG_DATA */ + +-static struct cmsghdr *cmptr; +-#define CONTROLLEN sizeof (struct cmsghdr) + sizeof (int) ++#define FD_LEN (sizeof(int) * 1) ++ ++static void *cmptr; + + static int + receive_fd (int helper_fd) + { + struct iovec iov [1]; + struct msghdr msg; ++ struct cmsghdr *cmp; + char buf [32]; + ++ if (cmptr == NULL && (cmptr = g_malloc (CMSG_SPACE(FD_LEN))) == NULL) ++ return -1; ++ + iov [0].iov_base = buf; + iov [0].iov_len = sizeof (buf); ++ ++ memset(&msg, 0, sizeof(msg)); + msg.msg_iov = iov; + msg.msg_iovlen = 1; + msg.msg_name = NULL; + msg.msg_namelen = 0; +- +- if (cmptr == NULL && (cmptr = g_malloc (CONTROLLEN)) == NULL) +- return -1; + msg.msg_control = (caddr_t) cmptr; +- msg.msg_controllen = CONTROLLEN; ++ msg.msg_controllen = CMSG_LEN(FD_LEN); + ++ memset(cmptr, 0, CMSG_SPACE(FD_LEN)); + if (recvmsg (helper_fd, &msg, 0) <= 0) + return -1; + +- return *(int *) CMSG_DATA (cmptr); ++ for (cmp = CMSG_FIRSTHDR(&msg); cmp != NULL; ++ cmp = CMSG_NXTHDR(&msg, cmp)) { ++ if (cmp->cmsg_type == SCM_RIGHTS) ++ return *(int *) CMSG_DATA (cmp); ++ } ++ ++ return -1; + } + + static int diff --git a/x11/gnome-libs/patches/patch-aq b/x11/gnome-libs/patches/patch-aq new file mode 100644 index 00000000000..f5c459e64fb --- /dev/null +++ b/x11/gnome-libs/patches/patch-aq @@ -0,0 +1,54 @@ +$NetBSD: patch-aq,v 1.1 2000/11/11 02:07:57 mycroft Exp $ + +--- zvt/gnome-pty-helper.c.orig Sat Mar 18 07:57:13 2000 ++++ zvt/gnome-pty-helper.c Sat Nov 11 01:59:16 2000 +@@ -115,14 +115,14 @@ + #endif + #endif /* CMSG_DATA */ + +-#define CONTROLLEN (sizeof (struct cmsghdr) + sizeof (int)) ++#define FD_LEN (sizeof(int) * 1) + +-static struct cmsghdr *cmptr; ++static void *cmptr; + + static int + init_msg_pass () + { +- cmptr = malloc (CONTROLLEN); ++ cmptr = malloc (CMSG_SPACE(FD_LEN)); + + if (cmptr) + return 0; +@@ -135,22 +135,26 @@ + { + struct iovec iov[1]; + struct msghdr msg; ++ struct cmsghdr *cmp; + char buf [1]; + + iov [0].iov_base = buf; + iov [0].iov_len = 1; + ++ memset(&msg, 0, sizeof(msg)); + msg.msg_iov = iov; + msg.msg_iovlen = 1; + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_control = (caddr_t) cmptr; +- msg.msg_controllen = CONTROLLEN; ++ msg.msg_controllen = CMSG_LEN(FD_LEN); + +- cmptr->cmsg_level = SOL_SOCKET; +- cmptr->cmsg_type = SCM_RIGHTS; +- cmptr->cmsg_len = CONTROLLEN; +- *(int *)CMSG_DATA (cmptr) = fd; ++ memset(cmptr, 0, CMSG_SPACE(FD_LEN)); ++ cmp = CMSG_FIRSTHDR(&msg); ++ cmp->cmsg_level = SOL_SOCKET; ++ cmp->cmsg_type = SCM_RIGHTS; ++ cmp->cmsg_len = CMSG_LEN(FD_LEN); ++ *(int *)CMSG_DATA (cmp) = fd; + + if (sendmsg (client_fd, &msg, 0) != 1) + return -1; |