Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH] sfdisk: warn if partition size exceeds 2 TiB limit
@ 2011-07-01 11:11 Petr Uzel
  0 siblings, 0 replies; only message in thread
From: Petr Uzel @ 2011-07-01 11:11 UTC (permalink / raw)
  To: util-linux; +Cc: rangelino

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

From: Roberto Angelino <rangelino@novell.com>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
---
 fdisk/sfdisk.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 6cd85a2..4ed5d37 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -1293,6 +1293,17 @@ partitions_ok(struct disk_desc *z) {
 	    }
     }
 
+    /* Are the partitions within the DOS 2TiB limit? */
+    {
+	for (p = partitions; p < partitions + partno; p++)
+	    if (p->size > (unsigned long) UINT32_MAX) {
+	        my_warn(_("Warning: partition %s of size %lu sectors exceeds "
+		          "msdos 2TiB limit\n"),
+		        PNO(p), p->size);
+	        return 0;
+	    }
+    }
+
     /* At most one chain of DOS extended partitions ? */
     /* It seems that the OS/2 fdisk has the additional requirement
        that the extended partition must be the fourth one */
-- 
1.7.3.4


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-01 11:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-01 11:11 [PATCH] sfdisk: warn if partition size exceeds 2 TiB limit Petr Uzel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox