parted/0024-gpt-when-mklabel-gpt-fails-always-provide-a-diagnost.patch
Brian C. Lane a248769183 - Rebasing Fedora patches with upstream master since v3.1 release
- Summary of important changes from upstream:
  - add support for a new Linux-specific GPT partition type code
  - partprobe: remove partitions when there is no partition table
  - libparted: refactor device-mapper partition sync code
  - libparted: remove extraneous blkpg add partition ped exception
  - libparted: don't probe every dm device in probe_all
- New Fedora changes:
  - libparted: Add Intel Rapid Start Technology partition flag.
  - libparted: Add UEFI System Partition flag.
  - libparted: Add hfs_esp partition flag to GPT.
  - libparted: Recognize btrfs filesystem
  - tests: Add btrfs and xfs to the fs probe test
2013-08-28 13:55:15 -07:00

39 lines
1.3 KiB
Diff

From 7ca7f595e4cef589db852394687a6ca0c2925fa7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Wed, 12 Sep 2012 10:48:33 +0200
Subject: [PATCH 24/69] gpt: when "mklabel gpt" fails, always provide a
diagnostic
* libparted/labels/gpt.c (gpt_alloc): When rejecting a device because
it is too small, give a diagnostic, as is done in every other failure
path through this function.
---
libparted/labels/gpt.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 564a889..63b30b9 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -504,9 +504,15 @@ gpt_alloc (const PedDevice *dev)
data_end = dev->length - 1
- GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size;
- /* If the device is too small to have room for data, reject it. */
+ /* If the device is too small to accommodate GPT headers, reject it. */
if (data_end < data_start)
- goto error_free_disk;
+ {
+ ped_exception_throw (PED_EXCEPTION_ERROR,
+ PED_EXCEPTION_OK,
+ _("device is so small it cannot even"
+ " accommodate GPT headers"));
+ goto error_free_disk;
+ }
disk->disk_specific = gpt_disk_data = ped_malloc (sizeof (GPTDiskData));
if (!disk->disk_specific)
--
1.8.3.1