]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: cleanup prober initialization
authorKarel Zak <kzak@redhat.com>
Fri, 13 May 2011 10:48:57 +0000 (12:48 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 16 May 2011 18:22:52 +0000 (20:22 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/blkid/src/partitions/partitions.c
shlibs/blkid/src/probe.c

index b4aca29bf230860073bbfab827e4873cb59b01d6..b89dad5bdad20c6bbfc4c946b50b2438639ca2f4 100644 (file)
@@ -620,7 +620,7 @@ details_only:
 int blkid_partitions_do_subprobe(blkid_probe pr, blkid_partition parent,
                const struct blkid_idinfo *id)
 {
-       int rc = 1;
+       int rc = 1, flags;
        blkid_partlist ls;
        blkid_loff_t saved_sz, saved_off, sz, off;
 
@@ -647,6 +647,9 @@ int blkid_partitions_do_subprobe(blkid_probe pr, blkid_partition parent,
                return -1;
        }
 
+       /* flags depends on size of the partition */
+       flags = pr->flags;
+
        /* define sub-range with in device */
        blkid_probe_set_dimension(pr, off, sz);
 
@@ -659,6 +662,8 @@ int blkid_partitions_do_subprobe(blkid_probe pr, blkid_partition parent,
        /* restore the original setting */
        blkid_probe_set_dimension(pr, saved_off, saved_sz);
 
+       pr->flags = flags;
+
        DBG(DEBUG_LOWPROBE, printf(
                "parts: <---- %s subprobe done (parent=%p, rc=%d)\n",
                id->name, parent, rc));
index 54af59333cd1f9484573fed86dac0ec005907407..7cece7ef25621178eabd6ff9193fbd50d419bb63 100644 (file)
@@ -348,7 +348,6 @@ void blkid_reset_probe(blkid_probe pr)
        if (!pr)
                return;
 
-       blkid_probe_reset_buffer(pr);
        blkid_probe_reset_vals(pr);
 
        pr->cur_chain = NULL;
@@ -595,6 +594,7 @@ int blkid_probe_set_device(blkid_probe pr, int fd,
                return -1;
 
        blkid_reset_probe(pr);
+       blkid_probe_reset_buffer(pr);
 
        if ((pr->flags & BLKID_FL_PRIVATE_FD) && pr->fd >= 0)
                close(pr->fd);
@@ -602,12 +602,17 @@ int blkid_probe_set_device(blkid_probe pr, int fd,
        pr->flags &= ~BLKID_FL_PRIVATE_FD;
        pr->flags &= ~BLKID_FL_TINY_DEV;
        pr->flags &= ~BLKID_FL_CDROM_DEV;
+       pr->prob_flags = 0;
        pr->fd = fd;
        pr->off = off;
        pr->size = 0;
        pr->devno = 0;
+       pr->disk_devno = 0;
        pr->mode = 0;
        pr->blkssz = 0;
+       pr->wipe_off = 0;
+       pr->wipe_size = 0;
+       pr->wipe_chain = NULL;
 
 #if defined(POSIX_FADV_RANDOM) && defined(HAVE_POSIX_FADVISE)
        /* Disable read-ahead */