summaryrefslogtreecommitdiff
path: root/util/nvmutil/lib
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-23 10:51:02 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-23 10:51:02 +0000
commita9165d2503ea597a1bb52d9cbae0cd61b9e0a544 (patch)
tree1806aaea75c977bfab91370c6cadd47d99f08244 /util/nvmutil/lib
parentba80191b7882432ae394f4051b32982bd8ab67ed (diff)
mkhtemp: fail if TMPDIR is SET, but set wrongmkhtemp-wip
right now we defer to fallbacks otherwise, which is wrong. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil/lib')
-rw-r--r--util/nvmutil/lib/file.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/util/nvmutil/lib/file.c b/util/nvmutil/lib/file.c
index 786c51fb..6546c252 100644
--- a/util/nvmutil/lib/file.c
+++ b/util/nvmutil/lib/file.c
@@ -453,16 +453,20 @@ env_tmpdir(int bypass_all_sticky_checks)
if (t != NULL && *t != '\0') {
if (tmpdir_policy(t,
- &allow_noworld_unsticky) == 0) {
-
- if (world_writeable_and_sticky(t,
- allow_noworld_unsticky,
- bypass_all_sticky_checks)) {
+ &allow_noworld_unsticky) < 0) {
+ errno = EPERM;
+ return NULL; /* errno already set */
+ }
- errno = saved_errno;
- return t;
- }
+ if (!world_writeable_and_sticky(t,
+ allow_noworld_unsticky,
+ bypass_all_sticky_checks)) {
+ errno = EPERM;
+ return NULL;
}
+
+ errno = saved_errno;
+ return t;
}
allow_noworld_unsticky = 0;