[ Upstream commit d70f79fef65810faf64dbae1f3a1b5623cdb2345 ] strchr() now propagates const when passed a const char * argument in newer GCC/glibc combinations, causing -Werror=discarded-qualifiers to fire on the assignment to next_path. Declare next_path as const char * since it is only used for pointer arithmetic, never written through. [ clrkwllms: only the next_path change from the upstream commit applies to 6.1.y ] Assisted-by: Claude:claude-sonnet-4.6 Signed-off-by: Clark Williams --- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 7bd6aff6e260..33b214a91338 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -10748,7 +10748,7 @@ static int resolve_full_path(const char *file, char *result, size_t result_sz) if (!search_paths[i]) continue; for (s = search_paths[i]; s != NULL; s = strchr(s, ':')) { - char *next_path; + const char *next_path; int seg_len; if (s[0] == ':') -- 2.54.0