Skip to content

Commit 9389e31

Browse files
EvilOlafamazingfate
authored andcommitted
libbpf: fix const correctness in resolve_full_path for gcc15
gcc 15's C library headers use _Generic to return const char * from strchr() when passed a const char * input. With -Werror=discarded- qualifiers, assigning this to a char * fails. next_path only uses the pointer for arithmetic to calculate segment length, never modifies the string. const char * is the correct type. Signed-off-by: EvilOlaf <evilolaf@users.noreply.github.com>
1 parent 3b59f44 commit 9389e31

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/lib/bpf/libbpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10738,7 +10738,7 @@ static int resolve_full_path(const char *file, char *result, size_t result_sz)
1073810738
if (!search_paths[i])
1073910739
continue;
1074010740
for (s = search_paths[i]; s != NULL; s = strchr(s, ':')) {
10741-
char *next_path;
10741+
const char *next_path;
1074210742
int seg_len;
1074310743

1074410744
if (s[0] == ':')

0 commit comments

Comments
 (0)