blob: 612a535d3c0a1a0d177b4e472eae3d670ca96a31 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001From 1803ea271b93370fdcf7ec497277344f1e775429 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---
14 src/machine/machine-dbus.c | 5 +++++
15 1 file changed, 5 insertions(+)
16
17--- a/src/machine/machine-dbus.c
18+++ b/src/machine/machine-dbus.c
19@@ -10,6 +10,11 @@
20 #include <libgen.h>
21 #undef basename
22
23+#if !defined(__GLIBC__)
24+#include <string.h>
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-get-properties.h"