summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CODING_STYLE7
-rw-r--r--src/basic/util.c4
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c4
-rw-r--r--src/machine/machine-dbus.c4
4 files changed, 10 insertions, 9 deletions
diff --git a/CODING_STYLE b/CODING_STYLE
index bdec988ce6..dbadfbdb54 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -210,11 +210,12 @@
c) recvmsg() must get MSG_CMSG_CLOEXEC set
d) F_DUPFD_CLOEXEC should be used instead of F_DUPFD, and so on
-- We never use the XDG version of basename(). glibc defines it in
- libgen.h. The only reason to include that file is because dirname()
+- We never use the POSIX version of basename() (which glibc defines it in
+ libgen.h), only the GNU version (which glibc defines in string.h).
+ The only reason to include libgen.h is because dirname()
is needed. Everytime you need that please immediately undefine
basename(), and add a comment about it, so that no code ever ends up
- using the XDG version!
+ using the POSIX version!
- Use the bool type for booleans, not integers. One exception: in public
headers (i.e those in src/systemd/sd-*.h) use integers after all, as "bool"
diff --git a/src/basic/util.c b/src/basic/util.c
index b7c70af541..e0c5069ff8 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -60,8 +60,8 @@
#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. */
+ * 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
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 3aaaabf4ed..f08db2da89 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -29,8 +29,8 @@
#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. */
+ * 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
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
index 0892479a9a..9f026beb13 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
@@ -24,8 +24,8 @@
#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. */
+ * 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