| From fdc7fb940bb41020271b9db41d5608004efdbde5 Mon Sep 17 00:00:00 2001 |
| From: Khem Raj <raj.khem@gmail.com> |
| Date: Sun, 27 May 2018 08:36:44 -0700 |
| Subject: [PATCH] Define glibc compatible basename() for non-glibc systems |
| |
| Fixes builds with musl, even though systemd is adamant about |
| using non-posix basename implementation, we have a way out |
| |
| Upstream-Status: Inappropriate [musl specific] |
| |
| Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| --- |
| src/machine/machine-dbus.c | 5 +++++ |
| 1 file changed, 5 insertions(+) |
| |
| --- a/src/basic/string-util.h |
| +++ b/src/basic/string-util.h |
| @@ -26,6 +26,10 @@ |
| #define URI_UNRESERVED ALPHANUMERICAL "-._~" /* [RFC3986] */ |
| #define URI_VALID URI_RESERVED URI_UNRESERVED /* [RFC3986] */ |
| |
| +#if !defined(__GLIBC__) |
| +#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) |
| +#endif |
| + |
| static inline char* strstr_ptr(const char *haystack, const char *needle) { |
| if (!haystack || !needle) |
| return NULL; |