[parted-devel] [PATCH] parted: mkpart: Recognize negative numbers as start

Sjoerd Simons sjoerd.simons at collabora.co.uk
Fri Aug 8 10:11:55 UTC 2014


The mkpart syntax is: mkpart part-type [fs-type] start end. To recognize
whether fs-type is given, parted peeks at the next word and decide
whether it looks like a start value or not. As start numbers can be
negative, also recognize words starting with - as a start field rather
then a filesystem type
---
 parted/parted.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parted/parted.c b/parted/parted.c
index f27a035..85718cb 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -681,7 +681,7 @@ do_mkpart (PedDevice** dev, PedDisk** diskp)
 
         peek_word = command_line_peek_word ();
         if (part_type == PED_PARTITION_EXTENDED
-            || (peek_word && isdigit (peek_word[0]))) {
+            || (peek_word && (isdigit (peek_word[0]) || peek_word[0] == '-'))) {
                 fs_type = NULL;
         } else {
                 if (!command_line_get_fs_type (_("File system type?"),
-- 
2.0.1




More information about the parted-devel mailing list