summaryrefslogtreecommitdiff
path: root/sbin/fdisk/cmd.c
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>1997-10-21 22:49:37 +0000
committerNiels Provos <provos@cvs.openbsd.org>1997-10-21 22:49:37 +0000
commite3ff5dce520d9c30a0911b45bc5608b8f022ef0c (patch)
tree90ea0884dbff111867c56d2738ab0e311cf3c5c3 /sbin/fdisk/cmd.c
parent64b85db7003ca4383c9eca901082c2eb5574604d (diff)
make fdisk grok extended partitions again. we have to keep track of the
absolute offset of the current mbr and its relative position. because: the starting sector of the first mbr entry in an extended partition is relative to the starting offset of the whole mbr itself. the starting offset of a new extended partition is relative to the offset of the very first extended partition.
Diffstat (limited to 'sbin/fdisk/cmd.c')
-rw-r--r--sbin/fdisk/cmd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c
index 3b3f67a0911..5d25aabfa95 100644
--- a/sbin/fdisk/cmd.c
+++ b/sbin/fdisk/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.13 1997/10/19 23:58:50 deraadt Exp $ */
+/* $OpenBSD: cmd.c,v 1.14 1997/10/21 22:49:32 provos Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -56,7 +56,7 @@ Xreinit(cmd, disk, mbr, tt, offset)
/* Copy template MBR */
MBR_make(tt, buf);
- MBR_parse(buf, mbr);
+ MBR_parse(buf, 0, 0, mbr);
/* Fix up given mbr for this disk */
mbr->part[0].flag = 0;
@@ -203,6 +203,7 @@ Xselect(cmd, disk, mbr, tt, offset)
mbr_t *tt;
int offset;
{
+ static firstoff = 0;
int off;
int pn;
@@ -219,6 +220,10 @@ Xselect(cmd, disk, mbr, tt, offset)
printf("Partition %d is not an extended partition.\n", pn);
return (CMD_CONT);
}
+
+ if (firstoff == 0)
+ firstoff = off;
+
if (!off) {
printf("Loop to offset 0! Not selected.\n");
return (CMD_CONT);
@@ -228,7 +233,7 @@ Xselect(cmd, disk, mbr, tt, offset)
}
/* Recursion is beautifull! */
- USER_modify(disk, tt, off);
+ USER_modify(disk, tt, off, firstoff);
return (CMD_CONT);
}