commit: d6c91c0c3a8512635289978f9bc3266154dfbff3
parent 92efecb5fe4e6cad6b7c34e2e46e6f90d215e220
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Mon, 28 Jul 2025 13:21:47 +0200
cmd/mktemp: change default template to ./tmp.XXXXXXXX
This way it can be used with commands requiring an explicit path.
For example:
$ shtmp=$(mktemp)
$ foobar > "$shtmp"
$ . "$shtmp"
$ rm -f -- "$shtmp"
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmd/mktemp.1 b/cmd/mktemp.1
@@ -24,7 +24,7 @@ as last path component.
If
.Ar template
is not specified,
-.Ql tmp.XXXXXXXXXX
+.Ql ./tmp.XXXXXXXX
is used instead.
.br
Files are created with u+rw permissions, directories with u+rwx.
diff --git a/cmd/mktemp.c b/cmd/mktemp.c
@@ -79,7 +79,7 @@ int
main(int argc, char *argv[])
{
bool o_create_dir = false, o_quiet = false, o_unsafe = false;
- static char template[PATH_MAX] = "tmp.XXXXXXXXXX";
+ static char template[PATH_MAX] = "./tmp.XXXXXXXXXX";
const char *tmpdir = NULL;
#ifdef HAS_GETOPT_LONG