summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
blob: 89736bcfdedf92948dbaa48aec0a8d5d6ec7905a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From dd134880e9a16595ab473934577e873c748e9c7a 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 13/26] 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(+)

diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
index f5780f1aec..aec5825b3e 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
@@ -11,6 +11,11 @@
 #include <libgen.h>
 #undef basename
 
+#if !defined(__GLIBC__)
+#include <string.h>
+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
+#endif
+
 #include "alloc-util.h"
 #include "bus-common-errors.h"
 #include "bus-get-properties.h"
-- 
2.27.0