tests/tcg/linux-test: Adjust getsockname for musl

Unlike glibc, musl does not use transparent unions to hide
the different structures that overlap struct sockaddr.

Add an explicit cast to work around this.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2020-10-05 11:41:26 -05:00
parent 57c98ea9ac
commit 51f22c195b

View File

@ -296,7 +296,7 @@ static void test_socket(void)
server_fd = server_socket();
/* find out what port we got */
socklen = sizeof(server_addr);
ret = getsockname(server_fd, &server_addr, &socklen);
ret = getsockname(server_fd, (struct sockaddr *)&server_addr, &socklen);
chk_error(ret);
server_port = ntohs(server_addr.sin_port);