aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2014-04-17 19:21:12 +0200
committerAndreas Färber <afaerber@suse.de>2014-05-05 20:58:33 +0200
commit535b45631ad7176e10dab89d55443b5a096500b9 (patch)
treed78cd4408f6b5e4ea1092ee2bddc341ec9c222e5 /tests
parenta7d915f388355f5353f2b692a1abd7868b8307a1 (diff)
qtest: Be paranoid about accept() addrlen argument
POSIX specifies that address_len shall on output specify the length of the stored address; it does not however specify whether it may get updated on failure as well to, e.g., zero. In case EINTR occurs, re-initialize the variable to the desired value. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'tests')
-rw-r--r--tests/libqtest.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/libqtest.c b/tests/libqtest.c
index 4b90d9112a..71468ac9c7 100644
--- a/tests/libqtest.c
+++ b/tests/libqtest.c
@@ -89,8 +89,8 @@ static int socket_accept(int sock)
setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (void *)&timeout,
sizeof(timeout));
- addrlen = sizeof(addr);
do {
+ addrlen = sizeof(addr);
ret = accept(sock, (struct sockaddr *)&addr, &addrlen);
} while (ret == -1 && errno == EINTR);
if (ret == -1) {