summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib/mkhtemp.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-04-02 22:15:58 +0100
committerLeah Rowe <leah@libreboot.org>2026-04-10 22:59:08 +0100
commitf055809c17a8a29d9192b79a8fe0a0c0bc1660a0 (patch)
treee38301cbfe38bfd60635fcc13b83bde9fd968bd8 /util/libreboot-utils/lib/mkhtemp.c
parentfc3c7b9c3eeaa156ef235e172309e27bc7f2707b (diff)
lbutils/file: only override EEXIST if not set
in the linux fast path, we are universally overriding errno with EEXIST, which pollutes errno in case of debugging under fault condition. this is inconsistent with posix and also leah. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lib/mkhtemp.c')
-rw-r--r--util/libreboot-utils/lib/mkhtemp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/libreboot-utils/lib/mkhtemp.c b/util/libreboot-utils/lib/mkhtemp.c
index 4d511892..69e9f59d 100644
--- a/util/libreboot-utils/lib/mkhtemp.c
+++ b/util/libreboot-utils/lib/mkhtemp.c
@@ -717,7 +717,8 @@ mkhtemp_tmpfile_linux(int dirfd,
goto out;
}
- errno = EEXIST;
+ if (!errno)
+ errno = EEXIST;
err:
if (linked)
(void) unlinkat(dirfd, fname_copy, 0);