Patrick Williams | da29531 | 2023-12-05 16:48:56 -0600 | [diff] [blame] | 1 | From fdc7fb940bb41020271b9db41d5608004efdbde5 Mon Sep 17 00:00:00 2001 |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 27 May 2018 08:36:44 -0700 |
| 4 | Subject: [PATCH] Define glibc compatible basename() for non-glibc systems |
| 5 | |
| 6 | Fixes builds with musl, even though systemd is adamant about |
| 7 | using non-posix basename implementation, we have a way out |
| 8 | |
| 9 | Upstream-Status: Inappropriate [musl specific] |
| 10 | |
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 12 | --- |
| 13 | src/machine/machine-dbus.c | 5 +++++ |
| 14 | 1 file changed, 5 insertions(+) |
| 15 | |
Patrick Williams | da29531 | 2023-12-05 16:48:56 -0600 | [diff] [blame] | 16 | diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c |
| 17 | index 45bc056326..aee51d5da5 100644 |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 18 | --- a/src/machine/machine-dbus.c |
| 19 | +++ b/src/machine/machine-dbus.c |
Patrick Williams | da29531 | 2023-12-05 16:48:56 -0600 | [diff] [blame] | 20 | @@ -4,6 +4,11 @@ |
| 21 | #include <sys/mount.h> |
| 22 | #include <sys/wait.h> |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 23 | |
| 24 | +#if !defined(__GLIBC__) |
| 25 | +#include <string.h> |
| 26 | +#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) |
| 27 | +#endif |
| 28 | + |
| 29 | #include "alloc-util.h" |
| 30 | #include "bus-common-errors.h" |
| 31 | #include "bus-get-properties.h" |
Patrick Williams | da29531 | 2023-12-05 16:48:56 -0600 | [diff] [blame] | 32 | -- |
| 33 | 2.39.2 |
| 34 | |