From: Karel Zak Date: Wed, 6 Feb 2013 16:26:46 +0000 (+0100) Subject: libblkid: make blkid_new_probe_from_filename() usable on whole-disk X-Git-Tag: v2.23-rc1~238 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6e650f8895631dabc5b8bb809bed024896c3dcc5;p=thirdparty%2Futil-linux.git libblkid: make blkid_new_probe_from_filename() usable on whole-disk 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 Signed-off-by: Karel Zak --- diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c index f7f90761a2..9e3f8f6908 100644 --- a/libblkid/src/probe.c +++ b/libblkid/src/probe.c @@ -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; }