Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From ec335ef3bb903a7eaf054103cc51411e71e6448c Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 27 May 2018 08:36:44 -0700 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 4 | Subject: [PATCH] Define glibc compatible basename() for non-glibc systems |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 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 | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 12 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 13 | --- |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 14 | src/machine/machine-dbus.c | 5 +++++ |
| 15 | 1 file changed, 5 insertions(+) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 16 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 17 | Index: systemd-stable/src/machine/machine-dbus.c |
| 18 | =================================================================== |
| 19 | --- systemd-stable.orig/src/machine/machine-dbus.c |
| 20 | +++ systemd-stable/src/machine/machine-dbus.c |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 21 | @@ -11,6 +11,11 @@ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 22 | #include <libgen.h> |
| 23 | #undef basename |
| 24 | |
| 25 | +#if !defined(__GLIBC__) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 26 | +#include <string.h> |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 27 | +#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) |
| 28 | +#endif |
| 29 | + |
| 30 | #include "alloc-util.h" |
| 31 | #include "bus-common-errors.h" |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame] | 32 | #include "bus-get-properties.h" |