summaryrefslogtreecommitdiff
path: root/util/nvmutil/lib
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-23 08:44:01 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-23 08:48:34 +0000
commit7c414b2d849fd16a0c987d4c9d33db9eee0a610d (patch)
tree5fb636d8f92ed82203ff803c421753444c6f51b9 /util/nvmutil/lib
parent024862a1523c7c8ed6d812b1dc4ed4ecd23d413f (diff)
mkhtemp: fix bad close
the fd in fs_resolve_at is subsequently used note that in practise, this is not a real fix: the best fix is to cache all descriptors and free them at the end, once resolution is done. not a real fix, because now fd leaks, but it's dealt with on program close. not a util yet. just just stubbing this in main to test various features. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil/lib')
-rw-r--r--util/nvmutil/lib/file.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/util/nvmutil/lib/file.c b/util/nvmutil/lib/file.c
index 30694623..a0313405 100644
--- a/util/nvmutil/lib/file.c
+++ b/util/nvmutil/lib/file.c
@@ -2032,9 +2032,34 @@ fs_resolve_at(int dirfd, const char *path, int flags)
if (nextfd < 0)
goto err;
+/*
+don't close fd.
+it's used next by a few functions.
+this results in a fd leak, but
+makes the code work:
+in practise, your program
+will free all descriptors
+on exit
+
+what we need to do is figure out a proper
+system of storing descriptors,
+and freeing them when it's safe;
+see how this function is called
+and whatt calls those and you see what i mean
+
+who owns what is currently not consistent.
+needs rework.
+
+this will be fixed at a later date.
+justt leaving thtis in here for future me.
+
+with this uncommented, i always just get
+"Bad file descriptor" error:
+
saved_close_errno = errno;
(void) close_on_eintr(dirfd);
errno = saved_close_errno;
+*/
dirfd = nextfd;
nextfd = -1;