]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Mimic GNU basename() API for non-glibc library e.g. musl 16642/head
authorKhem Raj <raj.khem@gmail.com>
Fri, 15 Mar 2024 21:34:06 +0000 (14:34 -0700)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Fri, 23 Aug 2024 16:24:04 +0000 (16:24 +0000)
musl only provides POSIX version of basename and it has also removed
providing it via string.h header [1] which now results in compile errors
with newer compilers e.g. clang-18

[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7

Signed-off-by: Khem Raj <raj.khem@gmail.com>
(cherry picked from commit 0ef71391f0fb15039550a09c218977fa3e1abaf1)

zebra/zebra_netns_notify.c

index fb326b0ddf67702a1206da8eaa3f5aff93786301..3ac4fdd737168ad0958f0008d0cceac78eeea1bd 100644 (file)
 #define ZEBRA_NS_POLLING_INTERVAL_MSEC     1000
 #define ZEBRA_NS_POLLING_MAX_RETRIES  200
 
+#if !defined(__GLIBC__)
+#define basename(src) (strrchr(src, '/') ? strrchr(src, '/') + 1 : src)
+#endif
+
 DEFINE_MTYPE_STATIC(ZEBRA, NETNS_MISC, "ZebraNetNSInfo");
 static struct event *zebra_netns_notify_current;