mirror of
https://anongit.gentoo.org/git/repo/gentoo.git
synced 2025-12-19 16:38:01 +00:00
Thanks-to: ernsteiswuerfel Closes: https://bugs.gentoo.org/922613 Signed-off-by: Pacho Ramos <pacho@gentoo.org>
63 lines
1.9 KiB
Diff
63 lines
1.9 KiB
Diff
From dfd70608a6a2ea164b18e7874de58ef6fd781cef Mon Sep 17 00:00:00 2001
|
|
From: Solegaiter <159629996+Solegaiter@users.noreply.github.com>
|
|
Date: Tue, 18 Jun 2024 17:11:12 +0200
|
|
Subject: [PATCH] Patch libndp.c
|
|
|
|
This patches a bug that made it impossible to compile on gentoo musl. This is my first patch.
|
|
---
|
|
libndp/libndp.c | 37 +++++++++++++++++++++----------------
|
|
1 file changed, 21 insertions(+), 16 deletions(-)
|
|
|
|
diff --git a/libndp/libndp.c b/libndp/libndp.c
|
|
index 72ec92e..8c57092 100644
|
|
--- a/libndp/libndp.c
|
|
+++ b/libndp/libndp.c
|
|
@@ -200,27 +200,32 @@ static int myrecvfrom6(int sockfd, void *buf, size_t *buflen, int flags,
|
|
}
|
|
|
|
static int mysendto6(int sockfd, void *buf, size_t buflen, int flags,
|
|
- struct in6_addr *addr, uint32_t ifindex)
|
|
+ struct in6_addr *addr, uint32_t ifindex)
|
|
{
|
|
- struct sockaddr_in6 sin6;
|
|
- ssize_t ret;
|
|
+ struct sockaddr_in6 sin6;
|
|
+ ssize_t ret;
|
|
+ memset(&sin6, 0, sizeof(sin6));
|
|
+
|
|
+ memcpy(&sin6.sin6_addr, addr, sizeof(sin6.sin6_addr));
|
|
+
|
|
+ sin6.sin6_scope_id = ifindex;
|
|
|
|
- memset(&sin6, 0, sizeof(sin6));
|
|
- memcpy(&sin6.sin6_addr, addr, sizeof(sin6.sin6_addr));
|
|
- sin6.sin6_scope_id = ifindex;
|
|
resend:
|
|
- ret = sendto(sockfd, buf, buflen, flags, &sin6, sizeof(sin6));
|
|
- if (ret == -1) {
|
|
- switch(errno) {
|
|
- case EINTR:
|
|
- goto resend;
|
|
- default:
|
|
- return -errno;
|
|
- }
|
|
- }
|
|
- return 0;
|
|
+ ret = sendto(sockfd, buf, buflen, flags, (const struct sockaddr *)&sin6, sizeof(sin6));
|
|
+
|
|
+ if (ret == -1) {
|
|
+ switch(errno) {
|
|
+ case EINTR:
|
|
+ goto resend;
|
|
+ default:
|
|
+ return -errno;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
}
|
|
|
|
+
|
|
static const char *str_in6_addr(struct in6_addr *addr, char buf[static INET6_ADDRSTRLEN])
|
|
{
|
|
return inet_ntop(AF_INET6, addr, buf, INET6_ADDRSTRLEN);
|