summaryrefslogtreecommitdiffstats
path: root/docs/CODING_STYLE.md
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-03-08 22:43:07 +0100
committerLennart Poettering <lennart@poettering.net>2021-03-08 22:47:44 +0100
commitb775b1828df8d3ee53e8706cc8ca3d0b8726a621 (patch)
tree7869f8b320c6e8933fe4a80272c83d2e5b8402c8 /docs/CODING_STYLE.md
parentefi-loader: make efi_loader_entry_name_valid() check a bit stricter (diff)
downloadsystemd-b775b1828df8d3ee53e8706cc8ca3d0b8726a621.tar.xz
systemd-b775b1828df8d3ee53e8706cc8ca3d0b8726a621.zip
docs: document not to use FILENAME_MAX in our codebase
It's a weird thing. Let's explain why.
Diffstat (limited to 'docs/CODING_STYLE.md')
-rw-r--r--docs/CODING_STYLE.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/CODING_STYLE.md b/docs/CODING_STYLE.md
index 851676bc2b..c15dc1abf7 100644
--- a/docs/CODING_STYLE.md
+++ b/docs/CODING_STYLE.md
@@ -587,6 +587,12 @@ layout: default
time you need that please immediately undefine `basename()`, and add a
comment about it, so that no code ever ends up using the POSIX version!
+- Never use FILENAME_MAX. Use PATH_MAX instead (for checking maximum size of
+ paths) and NAME_MAX (for checking maximum size of filenames). FILENAME_MAX is
+ not POSIX, and is a confusingly named alias for PATH_MAX on Linux. Note the
+ NAME_MAX does not include space for a trailing NUL, but PATH_MAX does. UNIX
+ FTW!
+
## Committing to git
- Commit message subject lines should be prefixed with an appropriate component