Files
buildroot/package/odhcp6c/0001-odhcp6c-const-cast-for-c23-compatibility.patch
Bernd Kuhls 8aff626d5c package/odhcp6c: fix build with glibc >= 2.43
Buildroot commit 227378b593 bumped glibc
to 2.43 causing build errors in odhcp6c like:

/home/autobuild/autobuild/instance-10/output-1/build/odhcp6c-f19dd37fb467c9cf10cad57aefa0d048312d7dfd/src/config.c:
 In function 'config_parse_opt_string':
/home/autobuild/autobuild/instance-10/output-1/build/odhcp6c-f19dd37fb467c9cf10cad57aefa0d048312d7dfd/src/config.c:338:21:
 error: initialization discards 'const' qualifier from pointer target
 type [-Werror=discarded-qualifiers]
  338 |         char *sep = strpbrk(src, ARRAY_SEP);

Add upstream commit to fix the problem.

Fixes:
https://autobuild.buildroot.net/results/efb/efb43d2dc069f5ba9c56816d670a8a2a3682d9ae/

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Signed-off-by: Arnout Vandecappelle <arnout@rnout.be>
2026-05-29 20:03:45 +02:00

103 lines
3.1 KiB
Diff

From 3b69378125aba61b3391bf5fe607983ce75b839c Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Wed, 8 Apr 2026 14:14:56 -0700
Subject: [PATCH] odhcp6c: const cast for c23 compatibility
strpbrk is now a macro that returns const based on the parameter. Cast
it away when we don't want const.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Upstream: https://github.com/openwrt/odhcp6c/pull/156
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
src/config.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/config.c b/src/config.c
index 54e2d35..c1a3a99 100644
--- a/src/config.c
+++ b/src/config.c
@@ -338,7 +338,7 @@ static int config_parse_opt_u8(const char *src, uint8_t **dst)
static int config_parse_opt_string(const char *src, uint8_t **dst, const bool array)
{
int o_len = 0;
- char *sep = strpbrk(src, ARRAY_SEP);
+ char *sep = strpbrk((char*)src, ARRAY_SEP);
if (sep && !array)
return -1;
@@ -362,7 +362,7 @@ static int config_parse_opt_string(const char *src, uint8_t **dst, const bool ar
src = sep;
if (sep)
- sep = strpbrk(src, ARRAY_SEP);
+ sep = strpbrk((char*)src, ARRAY_SEP);
} while (src);
return o_len;
@@ -371,7 +371,7 @@ static int config_parse_opt_string(const char *src, uint8_t **dst, const bool ar
static int config_parse_opt_dns_string(const char *src, uint8_t **dst, const bool array)
{
int o_len = 0;
- char *sep = strpbrk(src, ARRAY_SEP);
+ char *sep = strpbrk((char*)src, ARRAY_SEP);
if (sep && !array)
return -1;
@@ -399,7 +399,7 @@ static int config_parse_opt_dns_string(const char *src, uint8_t **dst, const boo
src = sep;
if (sep)
- sep = strpbrk(src, ARRAY_SEP);
+ sep = strpbrk((char*)src, ARRAY_SEP);
} while (src);
return o_len;
@@ -408,7 +408,7 @@ static int config_parse_opt_dns_string(const char *src, uint8_t **dst, const boo
static int config_parse_opt_ip6(const char *src, uint8_t **dst, const bool array)
{
int o_len = 0;
- char *sep = strpbrk(src, ARRAY_SEP);
+ char *sep = strpbrk((char*)src, ARRAY_SEP);
if (sep && !array)
return -1;
@@ -433,7 +433,7 @@ static int config_parse_opt_ip6(const char *src, uint8_t **dst, const bool array
src = sep;
if (sep)
- sep = strpbrk(src, ARRAY_SEP);
+ sep = strpbrk((char*)src, ARRAY_SEP);
} while (src);
return o_len;
@@ -442,7 +442,7 @@ static int config_parse_opt_ip6(const char *src, uint8_t **dst, const bool array
static int config_parse_opt_user_class(const char *src, uint8_t **dst, const bool array)
{
int o_len = 0;
- char *sep = strpbrk(src, ARRAY_SEP);
+ char *sep = strpbrk((char*)src, ARRAY_SEP);
if (sep && !array)
return -1;
@@ -471,7 +471,7 @@ static int config_parse_opt_user_class(const char *src, uint8_t **dst, const boo
src = sep;
if (sep)
- sep = strpbrk(src, ARRAY_SEP);
+ sep = strpbrk((char*)src, ARRAY_SEP);
} while (src);
return o_len;
@@ -555,7 +555,7 @@ int config_parse_opt(const char *opt)
struct odhcp6c_opt *dopt = NULL;
int ret = -1;
- data = strpbrk(opt, ":");
+ data = strpbrk((char*)opt, ":");
if (!data)
return -1;