projects
/
project
/
fstools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2e3aca2
)
libfstools: handle open() return value properly in F2FS check
author
Daniel Golle
<daniel@makrotopia.org>
Mon, 23 Aug 2021 16:55:31 +0000
(17:55 +0100)
committer
Daniel Golle
<daniel@makrotopia.org>
Wed, 25 Aug 2021 21:46:16 +0000
(22:46 +0100)
Coverity CID:
1490101
Argument cannot be negative
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
libfstools/common.c
patch
|
blob
|
history
diff --git
a/libfstools/common.c
b/libfstools/common.c
index f2d415d7012ce36bb885ed0fc71dcc63092050a8..c4847766a0389a444b2dab39c2c14a0574587d97 100644
(file)
--- 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;