diff options
| author | Leah Rowe <leah@libreboot.org> | 2022-12-08 21:20:53 +0000 | 
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2022-12-08 21:20:53 +0000 | 
| commit | 27876c6421b5eb1f318688a38698f3c2067131a8 (patch) | |
| tree | 648f99e52b1249f5495c63f6811b18b57b773415 /util/nvmutil | |
| parent | 960af2d6e8d882d958d25333e7cab864877e37b5 (diff) | |
util/nvmutil: return error when fstat() is -1
Another oversight in my error handling.
Diffstat (limited to 'util/nvmutil')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 3 | 
1 files changed, 2 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 759edea0..ef0a71e6 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -143,7 +143,8 @@ readFromFile(int *fd, uint8_t *buf, const char *path, int flags, size_t size)  	} else if (((*fd) = open(path, flags)) == -1) {  		return -1;  	} else if (size == SIZE_8KB) { -		fstat((*fd), &st); +		if (fstat((*fd), &st) == -1) +			return -1;  		if ((st.st_size != SIZE_8KB) && strcmp(path, "/dev/urandom")) {  			fprintf(stderr, "Bad file size\n");  			errno = ECANCELED;  | 
