util/nvmutil: close random_fd only if used

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-08 03:22:50 +00:00
parent 63fcc0891f
commit ec3ab4059c

View File

@@ -267,8 +267,10 @@ main(int argc, char *argv[])
if (close(gbe_fd) == -1)
err(ECANCELED, "close '%s'", fname);
#ifndef HAVE_ARC4RANDOM_BUF
if (close(urandom_fd) == -1)
err(ECANCELED, "close '%s'", rname);
if (urandom_fd > -1) {
if (close(urandom_fd) == -1)
err(ECANCELED, "close '%s'", rname);
}
#endif
/*