diff options
Diffstat (limited to 'util/nvmutil/nvmutil.c')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index d7cd943c..7cc782c8 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -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) { |
