# Fix #473207 - parted cannot recognize any arguments to various commands # Patch from IBM bugzilla, also showed up on parted-devel ML (not checked in yet) diff -Nuarp parted-1.8.8.org/parted/parted.c parted-1.8.8/parted/parted.c --- parted-1.8.8.org/parted/parted.c 2009-01-19 03:20:37.000000000 -0600 +++ parted-1.8.8/parted/parted.c 2009-01-19 03:20:37.000000000 -0600 @@ -511,12 +511,11 @@ do_cp (PedDevice** dev) _("Can't copy an extended partition.")); goto error_destroy_disk; } - if (!_partition_warn_busy (src)) - goto error_destroy_disk; - if (!command_line_get_partition (_("Destination partition number?"), dst_disk, &dst)) goto error_destroy_disk; + if (!_partition_warn_busy (src)) + goto error_destroy_disk; if (!_partition_warn_busy (dst)) goto error_destroy_disk; @@ -603,6 +602,9 @@ do_mklabel (PedDevice** dev) if (!disk) ped_exception_catch (); ped_exception_leave_all (); + if (!command_line_get_disk_type (_("New disk label type?"), &type)) + goto error; + if (disk) { if (!_disk_warn_busy (disk)) goto error_destroy_disk; @@ -612,9 +614,6 @@ do_mklabel (PedDevice** dev) ped_disk_destroy (disk); } - if (!command_line_get_disk_type (_("New disk label type?"), &type)) - goto error; - disk = ped_disk_new_fresh (*dev, type); if (!disk) goto error; @@ -646,15 +645,15 @@ do_mkfs (PedDevice** dev) if (!disk) goto error; + if (!command_line_get_partition (_("Partition number?"), disk, &part)) + goto error_destroy_disk; + if (!command_line_get_fs_type (_("File system type?"), &type)) + goto error_destroy_disk; if (!opt_script_mode && !_partition_warn_loss()) goto error_destroy_disk; - if (!command_line_get_partition (_("Partition number?"), disk, &part)) - goto error_destroy_disk; if (!_partition_warn_busy (part)) goto error_destroy_disk; - if (!command_line_get_fs_type (_("File system type?"), &type)) - goto error_destroy_disk; fs = ped_file_system_create (&part->geom, type, g_timer); if (!fs) @@ -1046,8 +1045,6 @@ do_move (PedDevice** dev) if (!command_line_get_partition (_("Partition number?"), disk, &part)) goto error_destroy_disk; - if (!_partition_warn_busy (part)) - goto error_destroy_disk; if (part->type == PED_PARTITION_EXTENDED) { ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, _("Can't move an extended partition.")); @@ -1064,6 +1061,8 @@ do_move (PedDevice** dev) end = start + old_geom.length - 1; if (!command_line_get_sector (_("End?"), *dev, &end, &range_end)) goto error_close_fs; + if (!_partition_warn_busy (part)) + goto error_close_fs; /* set / test on "disk" */ if (!ped_geometry_init (&new_geom, *dev, start, end - start + 1)) @@ -1817,10 +1816,6 @@ do_resize (PedDevice** dev) if (!command_line_get_partition (_("Partition number?"), disk, &part)) goto error_destroy_disk; - if (part->type != PED_PARTITION_EXTENDED) { - if (!_partition_warn_busy (part)) - goto error_destroy_disk; - } start = part->geom.start; end = part->geom.end; @@ -1828,6 +1823,10 @@ do_resize (PedDevice** dev) goto error_destroy_disk; if (!command_line_get_sector (_("End?"), *dev, &end, &range_end)) goto error_destroy_disk; + if (part->type != PED_PARTITION_EXTENDED) { + if (!_partition_warn_busy (part)) + goto error_destroy_disk; + } if (!ped_geometry_init (&new_geom, *dev, start, end - start + 1)) goto error_destroy_disk;