summaryrefslogtreecommitdiffstats
path: root/shlibs/blkid/src/partitions/partitions.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/partitions/partitions.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/partitions/partitions.c')
-rw-r--r--shlibs/blkid/src/partitions/partitions.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shlibs/blkid/src/partitions/partitions.c b/shlibs/blkid/src/partitions/partitions.c
index 154365d79..e8d031137 100644
--- a/shlibs/blkid/src/partitions/partitions.c
+++ b/shlibs/blkid/src/partitions/partitions.c
@@ -505,7 +505,7 @@ static int idinfo_probe(blkid_probe pr, const struct blkid_idinfo *id)
int hasmag = 0;
int rc = 1; /* = nothing detected */
- if (id->minsz && id->minsz > pr->size)
+ if (pr->size <= 0 || (id->minsz && id->minsz > pr->size))
goto nothing; /* the device is too small */
mag = id->magics ? &id->magics[0] : NULL;