summaryrefslogtreecommitdiffstats
path: root/io
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2015-12-21 12:04:21 +0000
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:28:21 -0600
commitacaefdeb343d9394bd6a412e61133c55665402c1 (patch)
tree4d920ce0d91d76bd13f9ca8ae667f844881ae6f1 /io
parent7328ecfac521f1342b1454110d8bbe667cc11e3e (diff)
downloadhqemu-acaefdeb343d9394bd6a412e61133c55665402c1.zip
hqemu-acaefdeb343d9394bd6a412e61133c55665402c1.tar.gz
io: fix setting of QIO_CHANNEL_FEATURE_FD_PASS on server connections
The QIO_CHANNEL_FEATURE_FD_PASS feature flag is set in the qio_channel_socket_set_fd() method, however, this only deals with client side connections. To ensure server side connections also have the feature flag set, we must set it in qio_channel_socket_accept() too. This also highlighted a typo fix where the code updated the sockaddr struct in the wrong object instance. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'io')
-rw-r--r--io/channel-socket.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/io/channel-socket.c b/io/channel-socket.c
index 90b3c73..eed2ff5 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;
OpenPOWER on IntegriCloud