aports/testing/olsrd/gcc14.patch
2024-09-27 01:57:06 +00:00

52 lines
1.6 KiB
Diff

Source: https://github.com/OLSR/olsrd/pull/129/commits/46e14c71f957c5e577ea90ec9917b51103230225.patch
This patch applies the second of two hunks.
The first part is for a component that does not yet exist in version 0.9.8.
```
src/linux/kernel_routes_nl.c: In function 'rtnetlink_read':
src/linux/kernel_routes_nl.c:164:5: error: initialization of 'int' from 'void
*' makes integer from pointer without a cast [-Wint-conversion]
164 | NULL,
| ^~~~
src/linux/kernel_routes_nl.c:164:5: note: (near initialization for 'msg.__pad1')
```
--
From 46e14c71f957c5e577ea90ec9917b51103230225 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sun, 9 Jun 2024 16:18:18 -0700
Subject: [PATCH] fix compilation with GCC14
the msghdr has padding in both glibc and musl. Initialize with names to
avoid dealing with the padding.
There's also a wrong struct type that's an error now.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
diff --git a/src/linux/kernel_routes_nl.c b/src/linux/kernel_routes_nl.c
index 1a2810da2..f21d6bbe1 100644
--- a/src/linux/kernel_routes_nl.c
+++ b/src/linux/kernel_routes_nl.c
@@ -157,13 +157,13 @@ static void rtnetlink_read(int sock, void *data __attribute__ ((unused)), unsign
struct iovec iov;
struct sockaddr_nl nladdr;
struct msghdr msg = {
- &nladdr,
- sizeof(nladdr),
- &iov,
- 1,
- NULL,
- 0,
- 0
+ .msg_name = &nladdr,
+ .msg_namelen = sizeof(nladdr),
+ .msg_iov = &iov,
+ .msg_iovlen = 1,
+ .msg_control = NULL,
+ .msg_controllen = 0,
+ .msg_flags = 0,
};
char buffer[4096];