ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/fdpass.C
(Generate patch)

Comparing rxvt-unicode/src/fdpass.C (file contents):
Revision 1.6 by root, Sun Jan 22 00:48:13 2006 UTC vs.
Revision 1.9 by root, Sun Jan 22 16:36:40 2006 UTC

1// This file is part of libptytty. Do not make local modifications.
2// http://software.schmorp.de/pkg/libptytty
3
1/*--------------------------------*-C-*---------------------------------* 4/*----------------------------------------------------------------------*
2 * File: fdpass.C 5 * File: fdpass.C
3 *----------------------------------------------------------------------* 6 *----------------------------------------------------------------------*
4 * 7 *
5 * All portions of code are copyright by their respective author/s. 8 * All portions of code are copyright by their respective author/s.
6 * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com> 9 * Copyright (c) 2005-2006 Marc Lehmann <pcg@goof.com>
24 27
25#include <sys/uio.h> 28#include <sys/uio.h>
26#include <sys/types.h> 29#include <sys/types.h>
27#include <sys/socket.h> 30#include <sys/socket.h>
28 31
29#include "fdpass.h" 32#include "libptytty.h"
30 33
31#ifndef CMSG_LEN // CMSG_SPACe && CMSG_LEN are rfc2292 extensions to unix 34#ifndef CMSG_LEN // CMSG_SPACe && CMSG_LEN are rfc2292 extensions to unix
32# define CMSG_LEN(len) (sizeof (cmsghdr) + len) 35# define CMSG_LEN(len) (sizeof (cmsghdr) + len)
33#endif 36#endif
34 37
35int 38bool
36ptytty_send_fd (int socket, int fd) 39ptytty::send_fd (int socket, int fd)
37{ 40{
38 msghdr msg; 41 msghdr msg;
39 iovec iov; 42 iovec iov;
40 char buf [CMSG_LEN (sizeof (int))]; 43 char buf [CMSG_LEN (sizeof (int))];
41 char data = 0; 44 char data = 0;
57 60
58 *(int *)CMSG_DATA (cmsg) = fd; 61 *(int *)CMSG_DATA (cmsg) = fd;
59 62
60 msg.msg_controllen = cmsg->cmsg_len; 63 msg.msg_controllen = cmsg->cmsg_len;
61 64
62 return sendmsg (socket, &msg, 0); 65 return sendmsg (socket, &msg, 0) >= 0;
63} 66}
64 67
65int 68int
66ptytty_recv_fd (int socket) 69ptytty::recv_fd (int socket)
67{ 70{
68 msghdr msg; 71 msghdr msg;
69 iovec iov; 72 iovec iov;
70 char buf [CMSG_LEN (sizeof (int))]; /* ancillary data buffer */ 73 char buf [CMSG_LEN (sizeof (int))]; /* ancillary data buffer */
71 char data = 1; 74 char data = 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines