tests: as per CODING_STYLE undefine basename() right after including libgen.h
authorLennart Poettering <lennart@poettering.net>
Wed, 24 Oct 2018 15:06:28 +0000 (17:06 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 24 Oct 2018 15:08:12 +0000 (17:08 +0200)
src/shared/tests.c

index c6f608f..ec80395 100644 (file)
@@ -1,9 +1,14 @@
 /* SPDX-License-Identifier: LGPL-2.1+ */
 
-#include <libgen.h>
 #include <stdlib.h>
 #include <util.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 "alloc-util.h"
 #include "env-util.h"
 #include "fileio.h"