summaryrefslogtreecommitdiffstats
path: root/fdisk
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:26:24 +0100
committerKarel Zak2006-12-07 00:26:24 +0100
commitd162fcb550a77875c8f58fda0e0a0bd91f211c99 (patch)
treebd984959acd465b3058bd805f216d29dc0c3c1a6 /fdisk
parentImported from util-linux-2.12i tarball. (diff)
downloadkernel-qcow2-util-linux-d162fcb550a77875c8f58fda0e0a0bd91f211c99.tar.gz
kernel-qcow2-util-linux-d162fcb550a77875c8f58fda0e0a0bd91f211c99.tar.xz
kernel-qcow2-util-linux-d162fcb550a77875c8f58fda0e0a0bd91f211c99.zip
Imported from util-linux-2.12j tarball.
Diffstat (limited to 'fdisk')
-rw-r--r--fdisk/cfdisk.c10
-rw-r--r--fdisk/fdisk.c22
-rw-r--r--fdisk/i386_sys_types.c1
-rw-r--r--fdisk/sfdisk.c5
4 files changed, 33 insertions, 5 deletions
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c
index 81fa74a86..d45281000 100644
--- a/fdisk/cfdisk.c
+++ b/fdisk/cfdisk.c
@@ -1444,8 +1444,10 @@ new_part(int i) {
print_warning(_("No room to create the extended partition"));
return;
}
- (void) add_part(ext, DOS_EXTENDED, 0, first, last,
- (first == 0 ? sectors : 0), 0, &errmsg);
+ errmsg = 0;
+ if (add_part(ext, DOS_EXTENDED, 0, first, last,
+ (first == 0 ? sectors : 0), 0, &errmsg) && errmsg)
+ print_warning(errmsg);
first = ext_info.first_sector + ext_info.offset;
}
@@ -1456,7 +1458,9 @@ new_part(int i) {
if (first == 0 || IS_LOGICAL(num))
offset = sectors;
- (void) add_part(num, id, flags, first, last, offset, 0, &errmsg);
+ errmsg = 0;
+ if (add_part(num, id, flags, first, last, offset, 0, &errmsg) && errmsg)
+ print_warning(errmsg);
}
static void
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index 40a4967ef..b3b61be6f 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -295,6 +295,20 @@ set_changed(int i) {
ptes[i].changed = 1;
}
+static int
+is_garbage_table(void) {
+ int i;
+
+ for (i = 0; i < 4; i++) {
+ struct pte *pe = &ptes[i];
+ struct partition *p = pe->part_table;
+
+ if (p->boot_ind != 0 && p->boot_ind != 0x80)
+ return 1;
+ }
+ return 0;
+}
+
/*
* Avoid warning about DOS partitions when no DOS partition was changed.
* Here a heuristic "is probably dos partition".
@@ -630,7 +644,7 @@ read_extended(int ext) {
struct pte *pre = &ptes[partitions-1];
fprintf(stderr,
- _("Warning: deleting partitions after %d\n"),
+ _("Warning: omitting partitions after %d\n"),
partitions);
clear_partition(pre->ext_pointer);
pre->changed = 1;
@@ -1684,6 +1698,12 @@ list_table(int xtra) {
return;
}
+ if (is_garbage_table()) {
+ printf(_("This doesn't look like a partition table\n"
+ "Probably you selected the wrong device.\n\n"));
+ }
+
+
/* Heuristic: we list partition 3 of /dev/foo as /dev/foo3,
but if the device name ends in a digit, say /dev/foo1,
then the partition is called /dev/foo1p3. */
diff --git a/fdisk/i386_sys_types.c b/fdisk/i386_sys_types.c
index 94e50cc78..fb70b0851 100644
--- a/fdisk/i386_sys_types.c
+++ b/fdisk/i386_sys_types.c
@@ -74,6 +74,7 @@ struct systypes i386_sys_types[] = {
{0xb8, N_("BSDI swap")},
{0xbb, N_("Boot Wizard hidden")},
{0xbe, N_("Solaris boot")},
+ {0xbf, N_("Solaris")},
{0xc1, N_("DRDOS/sec (FAT-12)")},
{0xc4, N_("DRDOS/sec (FAT-16 < 32M)")},
{0xc6, N_("DRDOS/sec (FAT-16)")},
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 5c0c8d29f..7cebc33b4 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -792,7 +792,10 @@ static int
reread_ioctl(int fd) {
if (ioctl(fd, BLKRRPART)) {
perror("BLKRRPART");
- return -1;
+
+ /* 2.6.8 returns EIO for a zero table */
+ if (errno == EBUSY)
+ return -1;
}
return 0;
}