diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-10 00:32:28 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-10 00:32:28 +0800 |
commit | 33fa3493e5bc3dd14817bb34f5c9a3bbba4bc734 (patch) | |
tree | fc85fc999f239c827e89848ee7678e113051e5a1 /common | |
parent | 15698c0601393d7a0a1c0a0b26d42b3cb60ddf80 (diff) | |
download | pttbbs-33fa3493e5bc3dd14817bb34f5c9a3bbba4bc734.tar pttbbs-33fa3493e5bc3dd14817bb34f5c9a3bbba4bc734.tar.gz pttbbs-33fa3493e5bc3dd14817bb34f5c9a3bbba4bc734.tar.bz2 pttbbs-33fa3493e5bc3dd14817bb34f5c9a3bbba4bc734.tar.lz pttbbs-33fa3493e5bc3dd14817bb34f5c9a3bbba4bc734.tar.xz pttbbs-33fa3493e5bc3dd14817bb34f5c9a3bbba4bc734.tar.zst pttbbs-33fa3493e5bc3dd14817bb34f5c9a3bbba4bc734.zip |
* sendmsg() with ancillary on Linux seems like requiring unix domain socket original path, even if the socket was already opened.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4531 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'common')
-rw-r--r-- | common/sys/net.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/common/sys/net.c b/common/sys/net.c index 883b4d48..232d5bb1 100644 --- a/common/sys/net.c +++ b/common/sys/net.c @@ -258,7 +258,7 @@ int send_remote_fd(int tunnel, int fd) } // return: remote fd (-1 if error) -int recv_remote_fd(int tunnel) +int recv_remote_fd(int tunnel, const char *tunnel_path) { struct msghdr msg; struct iovec iov; @@ -267,6 +267,7 @@ int recv_remote_fd(int tunnel) int connfd = -1; char ccmsg[CMSG_SPACE(sizeof(connfd))]; struct cmsghdr *cmsg; + struct sockaddr_un sun = {0}; iov.iov_base = &dummy; iov.iov_len = 1; @@ -274,6 +275,12 @@ int recv_remote_fd(int tunnel) msg.msg_iovlen = 1; msg.msg_control = ccmsg; msg.msg_controllen = sizeof(ccmsg); + // XXX assigning msg_name here again is stupid, + // but seems like Linux need it (while FreeBSD does not...) + msg.msg_name = &sun; + msg.msg_namelen = sizeof(sun); + sun.sun_family = AF_UNIX; + strlcpy(sun.sun_path, tunnel_path, sizeof(sun.sun_path)); do { // ignore EINTR |