From cc62a975a21629d66557ee18ea9f4354b73e9e7f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 20 Jan 2010 23:51:13 +0100 Subject: [PATCH] libblkid: don't probe for GPT and Unixware PT on floppies Signed-off-by: Karel Zak --- shlibs/blkid/src/partitions/gpt.c | 1 + shlibs/blkid/src/partitions/partitions.c | 3 +++ shlibs/blkid/src/partitions/unixware.c | 1 + 3 files changed, 5 insertions(+) diff --git a/shlibs/blkid/src/partitions/gpt.c b/shlibs/blkid/src/partitions/gpt.c index 2ec3f739..2c3a3267 100644 --- a/shlibs/blkid/src/partitions/gpt.c +++ b/shlibs/blkid/src/partitions/gpt.c @@ -368,6 +368,7 @@ const struct blkid_idinfo gpt_pt_idinfo = { .name = "gpt", .probefunc = probe_gpt_pt, + .minsz = 1024 * 1440 + 1, /* ignore floppies */ /* * It would be possible to check for DOS signature (0xAA55), but diff --git a/shlibs/blkid/src/partitions/partitions.c b/shlibs/blkid/src/partitions/partitions.c index 82861a5b..154365d7 100644 --- a/shlibs/blkid/src/partitions/partitions.c +++ b/shlibs/blkid/src/partitions/partitions.c @@ -505,6 +505,9 @@ 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) + goto nothing; /* the device is too small */ + mag = id->magics ? &id->magics[0] : NULL; /* try to detect by magic string */ diff --git a/shlibs/blkid/src/partitions/unixware.c b/shlibs/blkid/src/partitions/unixware.c index 70b6626f..62dba764 100644 --- a/shlibs/blkid/src/partitions/unixware.c +++ b/shlibs/blkid/src/partitions/unixware.c @@ -173,6 +173,7 @@ const struct blkid_idinfo unixware_pt_idinfo = { .name = "unixware", .probefunc = probe_unixware_pt, + .minsz = 1024 * 1440 + 1, /* ignore floppies */ .magics = { { -- 2.39.5