]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: make blkid_new_probe_from_filename() usable on whole-disk
authorKarel Zak <kzak@redhat.com>
Wed, 6 Feb 2013 16:26:46 +0000 (17:26 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Feb 2013 16:39:28 +0000 (17:39 +0100)
This is stupid bug, when libblkid probe for partition table on
whole-disk device with old 0.90 Linux RAID then it creates clone of
the struct blkid_probe to avoid collisions with the original probing
setting.

If the cloned prober is unnecessary then it's deallocated by
blkid_free_probe() ... and this function also closes the file
descriptor if the device has been opened by blkid_new_probe_from_filename().

Fortunately we usually use open() + blkid_probe_set_device(), ...
except wipefs(1).

Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/probe.c

index f7f90761a2f702a1e9f884e5ddc2356a9455d52f..9e3f8f6908523fb9ed81c040083b3ed37a0b9525 100644 (file)
@@ -183,6 +183,8 @@ blkid_probe blkid_clone_probe(blkid_probe parent)
        pr->flags = parent->flags;
        pr->parent = parent;
 
+       pr->flags &= ~BLKID_FL_PRIVATE_FD;
+
        return pr;
 }