summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c7
-rw-r--r--src/machine/machinectl.c5
-rw-r--r--src/shared/util.c6
3 files changed, 16 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 1714188ffd..b884074d95 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -25,10 +25,15 @@
#include <fcntl.h>
#include <malloc.h>
-#include <libgen.h>
#include <sys/mman.h>
#include <sys/prctl.h>
+/* When we include libgen.h because we need dirname() we immediately
+ * undefine basename() since libgen.h defines it as a macro to the XDG
+ * version which is really broken. */
+#include <libgen.h>
+#undef basename
+
#include "util.h"
#include "strv.h"
#include "memfd-util.h"
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 16ce2f424b..9f8c68b184 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -31,8 +31,13 @@
#include <arpa/inet.h>
#include <net/if.h>
#include <sys/mount.h>
+
+/* When we include libgen.h because we need dirname() we immediately
+ * undefine basename() since libgen.h defines it as a macro to the XDG
+ * version which is really broken. */
#include <libgen.h>
#undef basename
+
#include "sd-bus.h"
#include "log.h"
#include "util.h"
diff --git a/src/shared/util.c b/src/shared/util.c
index c53f9cdb6a..f5fcebebe7 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -60,10 +60,14 @@
#include <locale.h>
#include <sys/personality.h>
#include <sys/xattr.h>
-#include <libgen.h>
#include <sys/statvfs.h>
#include <sys/file.h>
#include <linux/fs.h>
+
+/* When we include libgen.h because we need dirname() we immediately
+ * undefine basename() since libgen.h defines it as a macro to the XDG
+ * version which is really broken. */
+#include <libgen.h>
#undef basename
#ifdef HAVE_SYS_AUXV_H