[parted-devel] [PATCH 6/7] parted: Add stub resize command for backward compatibility

Phillip Susi psusi at ubuntu.com
Sun May 25 21:11:32 UTC 2014


To make sure that older scripts trying to use the resize command do not
accidentally run the new resizepart command by mistake, this undocumented
stub command will throw an error if called.
---
 parted/parted.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/parted/parted.c b/parted/parted.c
index 17577a8..67ea7f3 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1505,6 +1505,16 @@ error:
 }
 
 static int
+do_resize (PedDevice **dev, PedDisk** diskp)
+{
+        ped_exception_throw (
+                PED_EXCEPTION_ERROR,
+                PED_EXCEPTION_CANCEL,
+                _("The resize command has been removed in parted 3.0"));
+        return 0;
+}
+
+static int
 do_resizepart (PedDevice** dev, PedDisk** diskp)
 {
         PedDisk                 *disk = *diskp;
@@ -1989,6 +1999,12 @@ NULL),
         str_list_create (_(start_end_msg), NULL), 1));
 
 command_register (commands, command_create (
+        str_list_create_unique ("resize", _("resize"), NULL),
+        do_resize,
+        NULL,
+        str_list_create (_(N_("The resize command was removed in parted 3.0\n")), NULL), 1));
+
+command_register (commands, command_create (
         str_list_create_unique ("resizepart", _("resizepart"), NULL),
         do_resizepart,
         str_list_create (
-- 
1.9.1




More information about the parted-devel mailing list