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. Cc: Eric Blake <ebl...@redhat.com> Signed-off-by: Andreas Färber <afaer...@suse.de> --- tests/libqtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/libqtest.c b/tests/libqtest.c index 4b90d91..71468ac 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) { -- 1.8.4.5