qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests/tcg/linux-test: Adjust getsockname for musl
@ 2020-10-05 16:58 Richard Henderson
  2020-10-05 17:23 ` Philippe Mathieu-Daudé
  2020-10-05 17:29 ` Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Henderson @ 2020-10-05 16:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

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.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 tests/tcg/multiarch/linux-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
index 8a7c15cd31..96bbad5823 100644
--- a/tests/tcg/multiarch/linux-test.c
+++ b/tests/tcg/multiarch/linux-test.c
@@ -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);
 
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tests/tcg/linux-test: Adjust getsockname for musl
  2020-10-05 16:58 [PATCH] tests/tcg/linux-test: Adjust getsockname for musl Richard Henderson
@ 2020-10-05 17:23 ` Philippe Mathieu-Daudé
  2020-10-05 17:29 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-05 17:23 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: alex.bennee

On 10/5/20 6:58 PM, Richard Henderson wrote:
> 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.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  tests/tcg/multiarch/linux-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
> index 8a7c15cd31..96bbad5823 100644
> --- a/tests/tcg/multiarch/linux-test.c
> +++ b/tests/tcg/multiarch/linux-test.c
> @@ -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);
>  
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tests/tcg/linux-test: Adjust getsockname for musl
  2020-10-05 16:58 [PATCH] tests/tcg/linux-test: Adjust getsockname for musl Richard Henderson
  2020-10-05 17:23 ` Philippe Mathieu-Daudé
@ 2020-10-05 17:29 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2020-10-05 17:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.bennee

On 10/5/20 11:58 AM, Richard Henderson wrote:
> 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.


Bah.  I meant to point out that this affects our microblaze docker cross-compile.


r~

> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  tests/tcg/multiarch/linux-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
> index 8a7c15cd31..96bbad5823 100644
> --- a/tests/tcg/multiarch/linux-test.c
> +++ b/tests/tcg/multiarch/linux-test.c
> @@ -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);
>  
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-05 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 16:58 [PATCH] tests/tcg/linux-test: Adjust getsockname for musl Richard Henderson
2020-10-05 17:23 ` Philippe Mathieu-Daudé
2020-10-05 17:29 ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).