immortalwrt/package/network/utils/iproute2/patches/402-bpf-fix-warning-from-basename.patch
Rany Hany b2e0775bc6 iproute2: fix build on GCC 14
Upstream patches:

401-bridge-vlan.c-bridge-vlan.c-fix-build-with-gcc-14-on.patch
402-bpf-fix-warning-from-basename.patch
403-bpf-include-libgen.h-for-basename.patch

The patch (400-rdma-include-libgen.h-for-basename.patch) was not
submitted upstream but just adds a missing include for basename.

Signed-off-by: Rany Hany <rany_hany@riseup.net>
2024-05-31 11:13:31 +02:00

39 lines
1.6 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 69e3b2fadcd32683db2942f31fe41f0fbb2185f8 Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Sat, 27 Jan 2024 13:58:14 -0800
Subject: [PATCH] bpf: fix warning from basename()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The function basename() expects a mutable character string,
which now causes a warning:
bpf_legacy.c: In function bpf_load_common:
bpf_legacy.c:975:38: warning: passing argument 1 of __xpg_basename discards const qualifier from pointer target type [-Wdiscarded-qualifiers]
975 | basename(cfg->object), cfg->mode == EBPF_PINNED ?
| ~~~^~~~~~~~
In file included from bpf_legacy.c:21:
/usr/include/libgen.h:34:36: note: expected char * but argument is of type const char *
34 | extern char *__xpg_basename (char *__path) __THROW;
Fixes: f20ff2f19552 ("bpf: keep parsed program mode in struct bpf_cfg_in")
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/bpf_legacy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/lib/bpf_legacy.c
+++ b/lib/bpf_legacy.c
@@ -971,8 +971,8 @@ int bpf_load_common(struct bpf_cfg_in *c
ops->cbpf_cb(nl, cfg->opcodes, cfg->n_opcodes);
if (cfg->mode == EBPF_OBJECT || cfg->mode == EBPF_PINNED) {
snprintf(annotation, sizeof(annotation), "%s:[%s]",
- basename(cfg->object), cfg->mode == EBPF_PINNED ?
- "*fsobj" : cfg->section);
+ basename(strdupa(cfg->object)),
+ cfg->mode == EBPF_PINNED ? "*fsobj" : cfg->section);
ops->ebpf_cb(nl, cfg->prog_fd, annotation);
}