diff options
author | lbmkplaceholder <placeholder@lbmkplaceholder.com> | 2022-12-21 15:28:15 +0000 |
---|---|---|
committer | lbmkplaceholder <placeholder@lbmkplaceholder.com> | 2022-12-21 15:28:15 +0000 |
commit | 001878112a27233b978ea230af75a7f45356d084 (patch) | |
tree | 1dc5be045deade16c9c1ce9494e248bea4f2c3c5 /util/nvmutil | |
parent | c6bb4d25f34ab8f1f5c649cb6894e8022bd8458d (diff) |
util/nvmutil: exit non-zero if close() fails
Diffstat (limited to 'util/nvmutil')
-rw-r--r-- | util/nvmutil/nvmutil.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 8549e8d2..a4f5a822 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -253,7 +253,8 @@ rhex(void) if ((rbuf = (uint8_t *) malloc(BUFSIZ)) == NULL) err(1, NULL); if (rfd != -1) { - close(rfd); + if (close(rfd)) + err(errno, "/dev/urandom"); rfd = -1; } if (readFromFile(&rfd, rbuf, "/dev/urandom", O_RDONLY, BUFSIZ) @@ -442,7 +443,8 @@ writeGbeFile(int *fd, const char *filename) errno = 0; if (pwrite((*fd), gbe, SIZE_8KB, 0) == SIZE_8KB) - close((*fd)); + if (close((*fd))) + err(errno, "%s", filename); if (errno != 0) return; |