[PATCH] fstools: libblkid-tiny: fix invalid open syscall return check
Daniel Danzberger
daniel at dd-wrt.com
Mon Aug 2 02:50:00 PDT 2021
open() returns -1 on error, not 0 (stdin).
Signed-off-by: Daniel Danzberger <daniel at dd-wrt.com>
---
libblkid-tiny/libblkid-tiny.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libblkid-tiny/libblkid-tiny.c b/libblkid-tiny/libblkid-tiny.c
index 18db4ef..6e8cd81 100644
--- a/libblkid-tiny/libblkid-tiny.c
+++ b/libblkid-tiny/libblkid-tiny.c
@@ -196,7 +196,7 @@ int probe_block(char *block, struct blkid_struct_probe *pr)
pr->err = -1;
pr->fd = open(block, O_RDONLY);
- if (!pr->fd)
+ if (pr->fd == -1)
return -1;
for (i = 0; i < ARRAY_SIZE(idinfos); i++) {
--
2.30.2
More information about the openwrt-devel
mailing list