blob: 8c83d5c8eb167116f51e2887d4d52ff020bdd5e6 [file] [log] [blame]
Patrick Williams03514f12024-04-05 07:04:11 -05001From 49aeccbec4bf620bb594999bbd4a9de669a3984c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 15 Mar 2024 14:34:06 -0700
4Subject: [PATCH] zebra: Mimic GNU basename() API for non-glibc library e.g.
5 musl musl only provides POSIX version of basename and it has also removed
6 providing it via string.h header [1] which now results in compile errors with
7 newer compilers e.g. clang-18
8
9[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
10
11Upstream-Status: Submitted [https://github.com/FRRouting/frr/pull/15561/]
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 zebra/zebra_netns_notify.c | 4 ++++
15 1 file changed, 4 insertions(+)
16
17diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c
18index 1bb1292e34..d55df2f62d 100644
19--- a/zebra/zebra_netns_notify.c
20+++ b/zebra/zebra_netns_notify.c
21@@ -41,6 +41,10 @@
22 #define ZEBRA_NS_POLLING_INTERVAL_MSEC 1000
23 #define ZEBRA_NS_POLLING_MAX_RETRIES 200
24
25+#if !defined(__GLIBC__)
26+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
27+#endif
28+
29 DEFINE_MTYPE_STATIC(ZEBRA, NETNS_MISC, "ZebraNetNSInfo");
30 static struct event *zebra_netns_notify_current;
31
32--
332.44.0
34