io: use qemu_accept to ensure SOCK_CLOEXEC is set

The QIOChannelSocket code mistakenly uses the bare accept()
function which does not set SOCK_CLOEXEC.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2016-03-10 17:07:27 +00:00
parent b83b68a013
commit de7971ffb9

View File

@ -343,8 +343,8 @@ qio_channel_socket_accept(QIOChannelSocket *ioc,
retry: retry:
trace_qio_channel_socket_accept(ioc); trace_qio_channel_socket_accept(ioc);
cioc->fd = accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr, cioc->fd = qemu_accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr,
&cioc->remoteAddrLen); &cioc->remoteAddrLen);
if (cioc->fd < 0) { if (cioc->fd < 0) {
trace_qio_channel_socket_accept_fail(ioc); trace_qio_channel_socket_accept_fail(ioc);
if (socket_error() == EINTR) { if (socket_error() == EINTR) {