blob: 67d5041917ff720d5ff15c56a0c2b147363b38ae [file] [log] [blame]
From ec335ef3bb903a7eaf054103cc51411e71e6448c 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(+)
Index: systemd-stable/src/machine/machine-dbus.c
===================================================================
--- systemd-stable.orig/src/machine/machine-dbus.c
+++ systemd-stable/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"