cfdisk - possible error ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
recently while fixing a disk, I got this error msg:
# cfdisk -Ps
FATAL ERROR: Bad primary partition 2: Partition ends in the final partial
cylinder

I was a little suspicious about the partition # 2.

$ yum list util-linux-ng
Installed Packages
util-linux-ng.i686                    2.17.2-7.fc13                     @updates

I looked up the cfdisk.c and saw some logic that may have a bug.

...
static void
fill_p_info(void) {
...
        for (i = 0; i < 4; i++) {
            p = & buffer.p.part[i];
            bs = get_start_sect(p);
            bsz = get_nr_sects(p);

            if (p->sys_ind > 0 &&
                add_part(i, p->sys_ind, p->boot_ind,
                         ((bs <= sectors) ? 0 : bs), bs + bsz - 1,
                         ((bs <= sectors) ? bs : 0), 1, &errmsg)) {
                    char *bad = _("Bad primary partition");
                    char *msg = (char *) xmalloc(strlen(bad) +
strlen(errmsg) + 30);
/*
BUG <--------------------------------------------------------------------------
     i - primary partition index 0-3
     For display, use i+1 to refer to primary partition number 1-4,
     which corresponds to e.g. /dev/sda1 thru /dev/sda4.
     NOTE: this kind of bug may be present in other places here as well.
                    sprintf(msg, "%s %d: %s", bad, i, errmsg);
BUG <--------------------------------------------------------------------------
*/
                    sprintf(msg, "%s %d: %s", bad, i+1, errmsg);     /* fix */
                    fatal(msg, 4);
            }
            if (is_extended(buffer.p.part[i].sys_ind))
                tmp_ext = ext_info;
        }
...
}

Please verify it and fix it if I am not mistaken.
Thanks.
JB
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux