void-packages/srcpkgs/elogind/patches/musl-basename.patch

43 lines
1.3 KiB
Diff

Add missing include for POSIX basename, since systemd-logind expects basename in string.h
diff -rup src/basic/musl_missing.h.orig src/basic/musl_missing.h
--- a/src/basic/musl_missing.h
+++ b/src/basic/musl_missing.h
@@ -56,6 +54,10 @@ void elogind_set_program_name(const char
} ) )
#endif
+/* Poor man's basename */
+#define basename(path) \
+ (strrchr(path, '/') ? strrchr(path, '/')+1 : path)
+
/* getnameinfo(3) glibc extensions are undefined in musl libc */
#define NI_IDN 0
#define NI_IDN_USE_STD3_ASCII_RULES 0
From c8d96ff2b87b8dfb8d521d4c2e6fb57992dbf659 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Wed, 21 Dec 2022 16:13:23 +0100
Subject: [PATCH] tests: we don't actually use basename() anymore
---
src/shared/tests.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/shared/tests.c b/src/shared/tests.c
index 5a05daa643..9d8bbeea79 100644
--- a/src/shared/tests.c
+++ b/src/shared/tests.c
@@ -7,12 +7,6 @@
#include <sys/mount.h>
#include <sys/wait.h>
-/* When we include libgen.h because we need dirname() we immediately
- * undefine basename() since libgen.h defines it as a macro to the POSIX
- * version which is really broken. We prefer GNU basename(). */
-#include <libgen.h>
-#undef basename
-
#include "sd-bus.h"
#include "alloc-util.h"