mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +02:00
util/nvmutil: only close gbe fd if opened
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -372,8 +372,10 @@ main(int argc, char *argv[])
|
||||
else if (gbe_flags != O_RDONLY)
|
||||
write_gbe_file();
|
||||
|
||||
if (close(gbe_fd) == -1)
|
||||
err(ECANCELED, "close '%s'", fname);
|
||||
if (gbe_fd > -1) {
|
||||
if (close(gbe_fd) == -1)
|
||||
err(ECANCELED, "close '%s'", fname);
|
||||
}
|
||||
|
||||
#ifndef HAVE_ARC4RANDOM_BUF
|
||||
if (urandom_fd > -1) {
|
||||
@@ -694,6 +696,11 @@ read_gbe_file_part(size_t p)
|
||||
GBE_PART_SIZE, gbe_file_offset(p, "pread"), fname, "pread");
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the first defense, but individual
|
||||
* commands should still perform checksum
|
||||
* verification where indicated, as a fallback.
|
||||
*/
|
||||
static void
|
||||
read_checksums(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user