Print this page
7999 'format' command says "Failed to initialise libfdisk"
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Gary Mills <gary_mills@fastmail.fm>
Reviewed by: Garrett D'Amore <garrett@damore.org>
*** 768,792 ****
*/
static int
fdisk_read_master_part_table(ext_part_t *epp)
{
struct dk_minfo_ext dkmp_ext;
uchar_t *buf;
int sectsize;
int size = sizeof (struct ipart);
int cpcnt = FD_NUMPART * size;
if (lseek(epp->dev_fd, 0, SEEK_SET) < 0) {
return (EIO);
}
if (ioctl(epp->dev_fd, DKIOCGMEDIAINFOEXT, &dkmp_ext) < 0) {
return (EIO);
}
! if (dkmp_ext.dki_lbsize < 512) {
return (EIO);
}
- sectsize = dkmp_ext.dki_lbsize;
buf = calloc(sectsize, sizeof (uchar_t));
if (buf == NULL) {
return (ENOMEM);
}
if (read(epp->dev_fd, buf, sectsize) < sectsize) {
--- 768,797 ----
*/
static int
fdisk_read_master_part_table(ext_part_t *epp)
{
struct dk_minfo_ext dkmp_ext;
+ struct dk_minfo dkmp;
uchar_t *buf;
int sectsize;
int size = sizeof (struct ipart);
int cpcnt = FD_NUMPART * size;
if (lseek(epp->dev_fd, 0, SEEK_SET) < 0) {
return (EIO);
}
if (ioctl(epp->dev_fd, DKIOCGMEDIAINFOEXT, &dkmp_ext) < 0) {
+ if (ioctl(epp->dev_fd, DKIOCGMEDIAINFO, &dkmp) < 0) {
return (EIO);
}
! sectsize = dkmp.dki_lbsize;
! } else {
! sectsize = dkmp_ext.dki_lbsize;
! }
! if (sectsize < 512) {
return (EIO);
}
buf = calloc(sectsize, sizeof (uchar_t));
if (buf == NULL) {
return (ENOMEM);
}
if (read(epp->dev_fd, buf, sectsize) < sectsize) {