diff options
| author | Daniel Golle | 2021-08-23 16:55:31 +0000 |
|---|---|---|
| committer | Daniel Golle | 2021-08-25 21:46:16 +0000 |
| commit | 50e6b20878cea96b7c4bc924c686ebee153874d5 (patch) | |
| tree | 6199ade935bbd3ca739a76eb4f93a7a7a835dae7 | |
| parent | 2e3aca299ea7bbe74f219860510c4b34e77c7aa4 (diff) | |
| download | fstools-50e6b20878cea96b7c4bc924c686ebee153874d5.tar.gz | |
libfstools: handle open() return value properly in F2FS check
Coverity CID: 1490101 Argument cannot be negative
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
| -rw-r--r-- | libfstools/common.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libfstools/common.c b/libfstools/common.c index f2d415d..c484776 100644 --- a/libfstools/common.c +++ b/libfstools/common.c @@ -90,8 +90,12 @@ static bool use_f2fs(struct volume *v, uint64_t offset, const char *bdev) int fd; fd = open(bdev, O_RDONLY); + if (fd < 0) + return false; + if (ioctl(fd, BLKGETSIZE64, &size) == 0) ret = size - offset > F2FS_MINSIZE; + close(fd); return ret; |