summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-18 05:13:02 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-18 05:13:02 +0000
commit71da2f53cf66a66ce5a7e6cb21fc6bc8f9bcb1db (patch)
treeb7e2613f89c8c7c64d6b52ffc188f193dea03602
parent3b389d4aecfec4a8ec1bff964b36fee1c2caad33 (diff)
util/nvmutil: initialise st in tmpdir
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/nvmutil/nvmutil.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 3e2e93e3..85326d5d 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -3000,9 +3000,13 @@ x_c_tmpdir(void)
struct stat st;
t = getenv("TMPDIR");
+ t = getenv("TMPDIR");
if (t && *t) {
- if ((st.st_mode & S_IWOTH) && !(st.st_mode & S_ISVTX))
- return NULL;
+ if (stat(t, &st) == 0 && S_ISDIR(st.st_mode)) {
+ if ((st.st_mode & S_IWOTH) && !(st.st_mode & S_ISVTX))
+ return NULL;
+ return t;
+ }
}
if (stat("/tmp", &st) == 0 && S_ISDIR(st.st_mode))