From 88923b088948446286290651abaca31464f884a8 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 4 Feb 2010 22:19:38 +0100 Subject: libblkid: don't return error on empty files Currently, the library does not allow to initialize blkid_probe if the file (or block device) is empty. The empty file is reported as an error. That's wrong. The empty file should be interpreted as a file without any FS or PT. It means that blkid_do_{probe,safeprobe,fullprobe}() have to return 1 ("nothing"). Reported-by: Christoph Hellwig Signed-off-by: Karel Zak --- shlibs/blkid/src/superblocks/superblocks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shlibs/blkid/src/superblocks/superblocks.c') diff --git a/shlibs/blkid/src/superblocks/superblocks.c b/shlibs/blkid/src/superblocks/superblocks.c index fd12e5ec2..56b334d03 100644 --- a/shlibs/blkid/src/superblocks/superblocks.c +++ b/shlibs/blkid/src/superblocks/superblocks.c @@ -311,7 +311,7 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn) printf("--> starting probing loop [SUBLKS idx=%d]\n", chn->idx)); - if (pr->size <= 1024 && !S_ISCHR(pr->mode)) + if (pr->size <= 0 || (pr->size <= 1024 && !S_ISCHR(pr->mode))) /* Ignore very very small block devices or regular files (e.g. * extended partitions). Note that size of the UBI char devices * is 1 byte */ -- cgit v1.2.3-55-g7522