blob: 736d525ad373330fe9db0d03e1afab1d4147af4f [file] [log] [blame]
Brad Bishop316dfdd2018-06-25 12:45:53 -04001From 5f1f064c81ea30acf93cfa0fb466b38f094f488c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 May 2018 08:36:44 -0700
4Subject: [PATCH] Define glibc compatible basename() for non-glibc systems
5
6Fixes builds with musl, even though systemd is adamant about
7using non-posix basename implementation, we have a way out
8
9Upstream-Status: Inappropriate [musl specific]
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 src/machine/machine-dbus.c | 4 ++++
14 1 file changed, 4 insertions(+)
15
16diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
17index 2d7806491b..9a3bdb1d76 100644
18--- a/src/machine/machine-dbus.c
19+++ b/src/machine/machine-dbus.c
20@@ -29,6 +29,10 @@
21 #include <libgen.h>
22 #undef basename
23
24+#if !defined(__GLIBC__)
25+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
26+#endif
27+
28 #include "alloc-util.h"
29 #include "bus-common-errors.h"
30 #include "bus-internal.h"
31--
322.17.0
33