Skip to contentSkip to conversation

rpc_svc_1: Fix incompatible pointer type error

PATCH In review Li Wang 3 participants 3 messages Jun 17, 2024 – Jun 19, 2024

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 rpc_svc_1: Fix incompatible pointer type error

To get rid of the compile error with GCC-14:

rpc_svc_1.c:109:12: error: assignment to ‘struct sockaddr_in *’ from incompatible pointer type ‘struct sockaddr_in6 *’ [-Wincompatible-pointer-types]
109 | sa = svc_getcaller(transp);
| ^

---
 .../network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c +1 -1
index d1c4df97f..d367691c4 100644
@@ -106,7 +106,7 @@ char *svc_getcaller_test(union u_argument *inVar, SVCXPRT * transp)
 	struct sockaddr_in *sa = NULL;
 	static int result;
 
-	sa = svc_getcaller(transp);
+	sa = (struct sockaddr_in *) svc_getcaller(transp);
 	//If the result is not NULL we consider that function call succeeds
 	//so returns 0 (PASS)
 	result = (sa != NULL) ? 0 : 1;
Signature · 5 lines
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by Wei Gao on v1 1/1
#1 lore raw
Quoted 32 lines · Li Wang

To get rid of the compile error with GCC-14:

rpc_svc_1.c:109:12: error: assignment to ‘struct sockaddr_in *’ from incompatible pointer type ‘struct sockaddr_in6 *’ [-Wincompatible-pointer-types]
109 | sa = svc_getcaller(transp);
| ^

---
 .../network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/network/rpc/rpc-tirpc/tests_pack/rpc_svc_1/rpc_svc_1.c +1 -1
index d1c4df97f..d367691c4 100644
@@ -106,7 +106,7 @@ char *svc_getcaller_test(union u_argument *inVar, SVCXPRT * transp)
 	struct sockaddr_in *sa = NULL;
 	static int result;
 
-	sa = svc_getcaller(transp);
+	sa = (struct sockaddr_in *) svc_getcaller(transp);
 	//If the result is not NULL we consider that function call succeeds
 	//so returns 0 (PASS)
 	result = (sa != NULL) ? 0 : 1;
Signature · 5 lines
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Hi Li, Wei,

Li, thanks for the fix, merged!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp