libsemanage: Mimic GNU basename() API for non-glibc library e.g. musl

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: Brahmajit Das <brahmajit.xyz@gmail.com>
This commit is contained in:
Brahmajit Das 2024-09-01 09:51:15 +00:00
parent e79a14c77b
commit 4d0f8cae5a
No known key found for this signature in database
GPG Key ID: 9836B476139277F8

View File

@ -63,6 +63,9 @@
#define PIPE_READ 0
#define PIPE_WRITE 1
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#if !defined(__GLIBC__)
#define basename(src) (strrchr(src, '/') ? strrchr(src, '/') + 1 : src)
#endif
static void semanage_direct_destroy(semanage_handle_t * sh);
static int semanage_direct_disconnect(semanage_handle_t * sh);