Index: parted-2.2/parted/parted.c =================================================================== --- parted-2.2.orig/parted/parted.c 2010-06-30 13:10:27.000000000 +0200 +++ parted-2.2/parted/parted.c 2010-06-30 13:11:09.000000000 +0200 @@ -2135,18 +2135,33 @@ do_align_check (PedDevice **dev) { PedDisk *disk = ped_disk_new (*dev); if (!disk) - return 0; + goto error; - enum AlignmentType align_type; + enum AlignmentType align_type = PA_OPTIMUM; PedPartition *part = NULL; - bool aligned = - (command_line_get_align_type (_("alignment type(min/opt)"), &align_type) - && command_line_get_partition (_("Partition number?"), disk, &part) - && partition_align_check (disk, part, align_type)); + + if (!command_line_get_align_type (_("alignment type(min/opt)"), &align_type)) + goto error_destroy_disk; + if (!command_line_get_partition (_("Partition number?"), disk, &part)) + goto error_destroy_disk; + + bool aligned = partition_align_check (disk, part, align_type); + if (!opt_script_mode) + printf(aligned ? _("%d aligned\n") : _("%d not aligned\n"), part->num); ped_disk_destroy (disk); + if (opt_script_mode) return aligned ? 1 : 0; + + /* Always return 1 in interactive mode, to be consistent + with the other modes. */ + return 1; + +error_destroy_disk: + ped_disk_destroy (disk); +error: + return 0; } static int