blob: 19a3eef847011c283929cf93793bd3b1f8f6c6e7 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From ec335ef3bb903a7eaf054103cc51411e71e6448c Mon Sep 17 00:00:00 2001
Brad Bishop19323692019-04-05 15:28:33 -04002From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 May 2018 08:36:44 -0700
Andrew Geissler82c905d2020-04-13 13:39:40 -05004Subject: [PATCH] Define glibc compatible basename() for non-glibc systems
Brad Bishop19323692019-04-05 15:28:33 -04005
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>
Andrew Geissler82c905d2020-04-13 13:39:40 -050012
Brad Bishop19323692019-04-05 15:28:33 -040013---
Andrew Geissler82c905d2020-04-13 13:39:40 -050014 src/machine/machine-dbus.c | 5 +++++
15 1 file changed, 5 insertions(+)
Brad Bishop19323692019-04-05 15:28:33 -040016
17diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
Andrew Geissler82c905d2020-04-13 13:39:40 -050018index 760ccb445cd0..0df20f3864b3 100644
Brad Bishop19323692019-04-05 15:28:33 -040019--- a/src/machine/machine-dbus.c
20+++ b/src/machine/machine-dbus.c
Andrew Geissler82c905d2020-04-13 13:39:40 -050021@@ -11,6 +11,11 @@
Brad Bishop19323692019-04-05 15:28:33 -040022 #include <libgen.h>
23 #undef basename
24
25+#if !defined(__GLIBC__)
Andrew Geissler82c905d2020-04-13 13:39:40 -050026+#include <string.h>
Brad Bishop19323692019-04-05 15:28:33 -040027+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
28+#endif
29+
30 #include "alloc-util.h"
31 #include "bus-common-errors.h"
32 #include "bus-internal.h"