diff mbox

[PULL,v1,11/18] io: use qemu_accept to ensure SOCK_CLOEXEC is set

Message ID 1457690648-19267-12-git-send-email-berrange@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel P. Berrangé March 11, 2016, 10:04 a.m. UTC
The QIOChannelSocket code mistakenly uses the bare accept()
function which does not set SOCK_CLOEXEC.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 io/channel-socket.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/io/channel-socket.c b/io/channel-socket.c
index 775bb9f..9b5f2d8 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -343,8 +343,8 @@  qio_channel_socket_accept(QIOChannelSocket *ioc,
 
  retry:
     trace_qio_channel_socket_accept(ioc);
-    cioc->fd = accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr,
-                      &cioc->remoteAddrLen);
+    cioc->fd = qemu_accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr,
+                           &cioc->remoteAddrLen);
     if (cioc->fd < 0) {
         trace_qio_channel_socket_accept_fail(ioc);
         if (socket_error() == EINTR) {