summaryrefslogtreecommitdiffstats
path: root/fdisk/fdisk.c
diff options
context:
space:
mode:
authorDavidlohr Bueso2012-05-04 13:35:32 +0200
committerKarel Zak2012-05-10 11:32:04 +0200
commit44d2fc819840d821db8dc965decf1f490ae9cc95 (patch)
tree94202b0b19db37b703adb803f52d3a1528d10959 /fdisk/fdisk.c
parentuuidd: remove unnecessary variables (diff)
downloadkernel-qcow2-util-linux-44d2fc819840d821db8dc965decf1f490ae9cc95.tar.gz
kernel-qcow2-util-linux-44d2fc819840d821db8dc965decf1f490ae9cc95.tar.xz
kernel-qcow2-util-linux-44d2fc819840d821db8dc965decf1f490ae9cc95.zip
fdisk: fix segfault on bsd label
Commit 8db8295d824cd0c8cba9385e4635d6e311d69d3f added a regression that causes the program to crash when touching the partition structure (pte) for BSD/OSF labels. Since DOS has its own initialization function, allow BSD labels to use it as well. Steps to reproduce: $> fdisk bsd.img (obtained from blkid regression test files) Command (m for help): p ... I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Segmentation fault Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'fdisk/fdisk.c')
-rw-r--r--fdisk/fdisk.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c
index acc84d1c8..dccaf27fd 100644
--- a/fdisk/fdisk.c
+++ b/fdisk/fdisk.c
@@ -763,6 +763,8 @@ static int get_boot(int try_only) {
return 0;
if (check_osf_label()) {
+ /* intialize partitions for BSD as well */
+ dos_init();
if (!valid_part_table_flag(MBRbuffer)) {
disklabel = OSF_LABEL;
return 0;