Skip to contentSkip to conversation

libqtest: Fix socket_accept() to pass address_len

PATCH Applied Andreas Färber 2 participants 3 messages May 27, 2012 – Jun 12, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libqtest: Fix socket_accept() to pass address_len

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.

---
 tests/libqtest.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tests/libqtest.c +1 -0
index 6d333ef..1d73fd1 100644
@@ -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);
Signature · 1 line
1.7.7
#1 lore raw

Am 28.05.2012 00:53, schrieb Andreas Färber:

Quoted 6 lines

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.

Ping? Verifiable by looking at the Linux man page.

/-F

Quoted 16 lines
---
 tests/libqtest.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tests/libqtest.c +1 -0
index 6d333ef..1d73fd1 100644
@@ -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);
#2 lore raw
In reply to Andreas Färber
Quoted 9 lines · Andreas Färber

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.

---
 tests/libqtest.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Thanks, applied to the trivial patches tree:
https://github.com/stefanha/qemu/commits/trivial-patches

Stefan