libblkid-tiny: fix invalid open syscall return check
authorDaniel Danzberger <daniel@dd-wrt.com>
Mon, 2 Aug 2021 09:50:00 +0000 (11:50 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Tue, 3 Aug 2021 20:38:32 +0000 (21:38 +0100)
open() returns -1 on error, not 0 (stdin).

Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
libblkid-tiny/libblkid-tiny.c

index 18db4efdd8bef7514baeaf43a306d529e5b36722..6e8cd81debd771fb1bca730189efba9b555cac61 100644 (file)
@@ -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++) {