summaryrefslogtreecommitdiffstats
path: root/shlibs/blkid/src/superblocks/superblocks.c
diff options
context:
space:
mode:
authorKarel Zak2010-02-04 22:19:38 +0100
committerKarel Zak2010-02-04 22:19:38 +0100
commit88923b088948446286290651abaca31464f884a8 (patch)
tree9d46df7d6459345b4cb08d7b02ef57110984f46b /shlibs/blkid/src/superblocks/superblocks.c
parentdocs: update TODO file (diff)
downloadkernel-qcow2-util-linux-88923b088948446286290651abaca31464f884a8.tar.gz
kernel-qcow2-util-linux-88923b088948446286290651abaca31464f884a8.tar.xz
kernel-qcow2-util-linux-88923b088948446286290651abaca31464f884a8.zip
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 <hch@infradead.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src/superblocks/superblocks.c')
-rw-r--r--shlibs/blkid/src/superblocks/superblocks.c2
1 files changed, 1 insertions, 1 deletions
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 */