From: Ammar Faizi <[email protected]>
To: Jens Axboe <[email protected]>
Cc: [email protected], Ammar Faizi <[email protected]>,
Louvian Lyndal <[email protected]>
Subject: [PATCH liburing 2/3] test/send_recv: Use proper cast for (struct sockaddr *) argument
Date: Wed, 15 Sep 2021 15:11:57 +0700 [thread overview]
Message-ID: <91812264f5600e1a460203d5297eb43aa978f9bf.1631692342.git.ammarfaizi2@gmail.com> (raw)
In-Reply-To: <2d53ef3f50713749511865a7f89e27c5378e316d.1631692342.git.ammarfaizi2@gmail.com>
This commit fixes build for armv8l.
Sometimes the compiler accepts (struct sockaddr_in *) to be passed to
(struct sockaddr *) without cast. But not all compilers agree with that.
Louvian found the following warning on armv8l:
```
send_recv.c:203:24: warning: incompatible pointer types passing 'struct sockaddr_in *' to parameter of type 'const struct sockaddr *' [-Wincompatible-pointer-types]
ret = connect(sockfd, &saddr, sizeof(saddr));
^~~~~~
/usr/include/sys/socket.h:308:59: note: passing argument to parameter '__addr' here
__socketcall int connect(int __fd, const struct sockaddr* __addr, socklen_t __addr_length);
^
1 warning generated.
```
Fix this by casting the second argument to (struct sockaddr *).
Reported-by: Louvian Lyndal <[email protected]>
Tested-by: Louvian Lyndal <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
---
test/send_recv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/send_recv.c b/test/send_recv.c
index 38ae27f..1ee0234 100644
--- a/test/send_recv.c
+++ b/test/send_recv.c
@@ -200,7 +200,7 @@ static int do_send(void)
return 1;
}
- ret = connect(sockfd, &saddr, sizeof(saddr));
+ ret = connect(sockfd, (struct sockaddr *)&saddr, sizeof(saddr));
if (ret < 0) {
perror("connect");
return 1;
--
2.30.2
next prev parent reply other threads:[~2021-09-15 8:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-15 8:11 [PATCH liburing 0/3] Fix build and add /test/output dir to .gitignore Ammar Faizi
2021-09-15 8:11 ` [PATCH liburing 1/3] test/io_uring_setup: Don't use `__errno` as local variable name Ammar Faizi
2021-09-15 8:11 ` Ammar Faizi [this message]
2021-09-15 8:11 ` [PATCH liburing 3/3] .gitignore: add `/test/output/` Ammar Faizi
2021-09-15 12:41 ` [PATCH liburing 0/3] Fix build and add /test/output dir to .gitignore Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=91812264f5600e1a460203d5297eb43aa978f9bf.1631692342.git.ammarfaizi2@gmail.com \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox