aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfram Schneider <wosch@FreeBSD.org>2024-10-27 16:33:39 +0000
committerWolfram Schneider <wosch@FreeBSD.org>2024-10-27 16:36:31 +0000
commit93181e38342fc48eb95f83842156be478a4a6f01 (patch)
tree1bad60b260262299736ce4a44f584d2277f9e8f2
parentd08713dcdb158b2f55a885e7cfbbe410272c55a2 (diff)
downloadsrc-93181e38342fc48eb95f83842156be478a4a6f01.tar.gz
src-93181e38342fc48eb95f83842156be478a4a6f01.zip
mktemp(1): 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
-rw-r--r--usr.bin/mktemp/mktemp.16
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/mktemp/mktemp.1 b/usr.bin/mktemp/mktemp.1
index 68a5a54aa5c5..063f25f216dc 100644
--- a/usr.bin/mktemp/mktemp.1
+++ b/usr.bin/mktemp/mktemp.1
@@ -59,7 +59,7 @@ any file name with some number of
.Ql X Ns s
appended
to it, for example
-.Pa /tmp/temp.XXXX .
+.Pa /tmp/temp.XXXXXXXXXX .
The trailing
.Ql X Ns s
are replaced with the current process number and/or a
@@ -196,7 +196,7 @@ where the script should quit if it cannot get a safe
temporary file.
.Bd -literal -offset indent
tempfoo=`basename $0`
-TMPFILE=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
+TMPFILE=`mktemp /tmp/${tempfoo}.XXXXXXXXXX` || exit 1
echo "program output" >> $TMPFILE
.Ed
.Pp
@@ -210,7 +210,7 @@ echo "program output" >> $TMPFILE
In this case, we want the script to catch the error itself.
.Bd -literal -offset indent
tempfoo=`basename $0`
-TMPFILE=`mktemp -q /tmp/${tempfoo}.XXXXXX`
+TMPFILE=`mktemp -q /tmp/${tempfoo}.XXXXXXXXXX`
if [ $? -ne 0 ]; then
echo "$0: Can't create temp file, exiting..."
exit 1