summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-25 20:54:24 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 06:59:42 +0000
commitee4f765719a8d8882466744ac310196e8f954d4b (patch)
tree105f3245235ad2b68de21b1d6f6f598a04c1cd06
parente8c4bccd86f43456a99fc9d49e657633b6e16188 (diff)
lbutils: close fd on rset failure
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--util/libreboot-utils/lib/rand.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/util/libreboot-utils/lib/rand.c b/util/libreboot-utils/lib/rand.c
index 7b53b6a4..31221d61 100644
--- a/util/libreboot-utils/lib/rand.c
+++ b/util/libreboot-utils/lib/rand.c
@@ -128,6 +128,10 @@ out:
errno = saved_errno;
return;
err:
+#if defined(USE_URANDOM) && \
+ ((USE_URANDOM) > 0)
+ close_no_err(&fd);
+#endif
err_no_cleanup(0, ECANCELED,
"Randomisation failure, possibly unsupported in your kernel");
exit(EXIT_FAILURE);