aboutsummaryrefslogtreecommitdiff
path: root/io/channel-socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'io/channel-socket.c')
-rw-r--r--io/channel-socket.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/io/channel-socket.c b/io/channel-socket.c
index 90b3c73..10a5b31 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -352,13 +352,19 @@ qio_channel_socket_accept(QIOChannelSocket *ioc,
goto error;
}
- if (getsockname(cioc->fd, (struct sockaddr *)&ioc->localAddr,
- &ioc->localAddrLen) < 0) {
+ if (getsockname(cioc->fd, (struct sockaddr *)&cioc->localAddr,
+ &cioc->localAddrLen) < 0) {
error_setg_errno(errp, socket_error(),
"Unable to query local socket address");
goto error;
}
+#ifndef WIN32
+ if (cioc->localAddr.ss_family == AF_UNIX) {
+ QIO_CHANNEL(cioc)->features |= (1 << QIO_CHANNEL_FEATURE_FD_PASS);
+ }
+#endif /* WIN32 */
+
trace_qio_channel_socket_accept_complete(ioc, cioc, cioc->fd);
return cioc;
@@ -487,15 +493,14 @@ static ssize_t qio_channel_socket_writev(QIOChannel *ioc,
QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(ioc);
ssize_t ret;
struct msghdr msg = { NULL, };
+ char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] = { 0 };
+ size_t fdsize = sizeof(int) * nfds;
+ struct cmsghdr *cmsg;
msg.msg_iov = (struct iovec *)iov;
msg.msg_iovlen = niov;
if (nfds) {
- char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)];
- size_t fdsize = sizeof(int) * nfds;
- struct cmsghdr *cmsg;
-
if (nfds > SOCKET_MAX_FDS) {
error_setg_errno(errp, -EINVAL,
"Only %d FDs can be sent, got %zu",