Patchwork [05/12] libqtest: Fix socket_accept() to pass address_len

login
register
mail settings
Submitter Stefan Hajnoczi
Date June 22, 2012, 9:40 a.m.
Message ID <1340358009-16033-6-git-send-email-stefanha@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/166558/
State New
Headers show

Comments

Stefan Hajnoczi - June 22, 2012, 9:40 a.m.
From: Andreas Färber <andreas.faerber@web.de>

accept() expects address_len to point to the length of the sockaddr on
input. Initialize it accordingly.

Resolves an assertion due to EFAULT on illumos.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 tests/libqtest.c |    1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/tests/libqtest.c b/tests/libqtest.c
index 6d333ef..1d73fd1 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -74,6 +74,7 @@  static int socket_accept(int sock)
     socklen_t addrlen;
     int ret;
 
+    addrlen = sizeof(addr);
     do {
         ret = accept(sock, (struct sockaddr *)&addr, &addrlen);
     } while (ret == -1 && errno == EINTR);