gentoo-overlay/sys-apps/systemd/files/musl/0013-Define-glibc-compatibl...

33 lines
956 B
Diff
Raw Normal View History

2021-06-17 15:59:32 +03:00
From 0c44af262cfa07c57db4b32de1f7610af47797f4 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(+)
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
2021-06-17 15:59:32 +03:00
index 3a1e4f9072..ab87b9882c 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"
2021-06-17 15:59:32 +03:00
#include "bus-get-properties.h"