git: 95b17d3b1c51 - main - mktemp(3): bring the documentation up to date with best practice
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 27 Oct 2024 16:43:09 UTC
The branch main has been updated by wosch:
URL: https://cgit.FreeBSD.org/src/commit/?id=95b17d3b1c5187d2630556eaa0f2107378ca3b4f
commit 95b17d3b1c5187d2630556eaa0f2107378ca3b4f
Author: Wolfram Schneider <wosch@FreeBSD.org>
AuthorDate: 2024-10-27 16:41:01 +0000
Commit: Wolfram Schneider <wosch@FreeBSD.org>
CommitDate: 2024-10-27 16:41:01 +0000
mktemp(3): bring the documentation up to date with best practice
Using short temp filenames as /tmp/temp.XXXX (4 or 6 X) was probably ok
20 years ago, but not anymore. Best practice is to use 10 X. Given that our
users often copy & paste examples from our manual pages we need to
update the documentation.
PR: 261437
---
lib/libc/stdio/mktemp.3 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/libc/stdio/mktemp.3 b/lib/libc/stdio/mktemp.3
index d00d3d4f61fb..93870f3865de 100644
--- a/lib/libc/stdio/mktemp.3
+++ b/lib/libc/stdio/mktemp.3
@@ -63,7 +63,7 @@ The template may be any file name with some number of
.Ql X Ns s
appended
to it, for example
-.Pa /tmp/temp.XXXXXX .
+.Pa /tmp/temp.XXXXXXXXXX .
The trailing
.Ql X Ns s
are replaced with a
@@ -116,7 +116,7 @@ and
respectively,
except they permit a suffix to exist in the template.
The template should be of the form
-.Pa /tmp/tmpXXXXXXsuffix .
+.Pa /tmp/tmpXXXXXXXXXXsuffix .
The
.Fn mkstemps
and
@@ -243,7 +243,7 @@ compilers were common.
For example, calling
.Fn mkstemp
with an argument of
-.Qq /tmp/tempfile.XXXXXX
+.Qq /tmp/tempfile.XXXXXXXXXX
will result in a core dump due to
.Fn mkstemp
attempting to modify the string constant that was given.