From 1228f7e0e5ade7ff10b4f494097e3f7eb45fd795 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Wed, 25 Mar 2026 00:23:48 +0000 Subject: util/mkhtemp: require at least 3 X the GNU one requires 3. we should be compatible with them. i'm going to work on the compatibility mode - this is phase one! Signed-off-by: Leah Rowe --- util/libreboot-utils/lib/mkhtemp.c | 2 +- util/libreboot-utils/mkhtemp.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'util/libreboot-utils') diff --git a/util/libreboot-utils/lib/mkhtemp.c b/util/libreboot-utils/lib/mkhtemp.c index 6b4898fd..377ec206 100644 --- a/util/libreboot-utils/lib/mkhtemp.c +++ b/util/libreboot-utils/lib/mkhtemp.c @@ -611,7 +611,7 @@ mkhtemp(int *fd, for (end = template + len; /* count X */ end > template && *--end == 'X'; xc++); - if (if_err(xc < 6 || xc > len, EINVAL) || + if (if_err(xc < 3 || xc > len, EINVAL) || if_err(fname_len > len, EOVERFLOW)) return -1; diff --git a/util/libreboot-utils/mkhtemp.c b/util/libreboot-utils/mkhtemp.c index e900c29b..261227cb 100644 --- a/util/libreboot-utils/mkhtemp.c +++ b/util/libreboot-utils/mkhtemp.c @@ -140,9 +140,9 @@ main(int argc, char *argv[]) for (p = template + tlen; p > template && *--p == 'X'; xc++); - if (xc < 6) + if (xc < 3) /* the gnu mktemp errs on less than 3 */ err_no_cleanup(stfu, EINVAL, - "template must end in at least 6 X"); + "template must have 3 X or more on end (12+ advised"); } /* user supplied -p PATH - WARNING: -- cgit v1.2.1