2019-04-15 02:08:41

by Rosen Penev

[permalink] [raw]
Subject: [PATCH] mount: Add missing cast to getsockname

Otherwise compilation can fail with incompatible pointer type.

Signed-off-by: Rosen Penev <[email protected]>
---
utils/mount/network.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/mount/network.c b/utils/mount/network.c
index fc21110..e166a82 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1062,7 +1062,7 @@ int clnt_ping(struct sockaddr_in *saddr, const unsigned long prog,
if (caddr) {
/* Get the address of our end of this connection */
socklen_t len = sizeof(*caddr);
- if (getsockname(sock, caddr, &len) != 0)
+ if (getsockname(sock, (struct sockaddr *) caddr, &len) != 0)
caddr->sin_family = 0;
}

--
2.17.1



2019-04-16 18:28:21

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] mount: Add missing cast to getsockname



On 4/14/19 10:08 PM, Rosen Penev wrote:
> Otherwise compilation can fail with incompatible pointer type.
>
> Signed-off-by: Rosen Penev <[email protected]>
Committed....

steved.

> ---
> utils/mount/network.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/utils/mount/network.c b/utils/mount/network.c
> index fc21110..e166a82 100644
> --- a/utils/mount/network.c
> +++ b/utils/mount/network.c
> @@ -1062,7 +1062,7 @@ int clnt_ping(struct sockaddr_in *saddr, const unsigned long prog,
> if (caddr) {
> /* Get the address of our end of this connection */
> socklen_t len = sizeof(*caddr);
> - if (getsockname(sock, caddr, &len) != 0)
> + if (getsockname(sock, (struct sockaddr *) caddr, &len) != 0)
> caddr->sin_family = 0;
> }
>
>