lib/mkhtemp.c: use standard suffix

it may seem counterintuitive that a shorter suffix is
better, but i think we should ideally look just like
what is made my any other tool, and other mktemp
tools generate:

tmp.XXXXXXXXXX

this is the default, but of course it could be changed.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-24 01:32:59 +00:00
parent f2544d094b
commit a5eed39a76

View File

@@ -50,8 +50,7 @@ new_tmp_common(int *fd, char **path, int type)
#endif #endif
struct stat st; struct stat st;
char suffix[] = char suffix[] = "tmp.XXXXXXXXXX";
"tmpXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
char *tmpdir = NULL; char *tmpdir = NULL;
int close_errno; int close_errno;
@@ -582,7 +581,7 @@ mkhtemp(int *fd,
while (end > template && *--end == 'X') while (end > template && *--end == 'X')
xc++; xc++;
if (xc < 12 || xc > len) { if (xc < 6 || xc > len) {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }