Skip to content

Commit

Permalink
libsemanage: Mimic GNU basename() API for non-glibc library e.g. musl
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
listout committed Sep 1, 2024
1 parent e79a14c commit 4d0f8ca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libsemanage/src/direct_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4d0f8ca

Please sign in to comment.