From b7ec0f07b339aed8bd2b8da3603b0ee9a6a7417a Mon Sep 17 00:00:00 2001 From: Pierre-Alexandre Meyer Date: Sat, 22 Aug 2009 11:08:04 -0700 Subject: [PATCH] hdt: enhance error reporting in the CLI (disk) parse_partition_table can fail for two reasons: disk I/O error or unrecognized partition layout (non msdos, corrupt, ...). In the latter case, we were displaying Error parsing disk 0x80 parse_partition_table: error 0 which is confusing. We now display Disk 0x80: unrecognized partition layout or the errno_disk in case of I/O errors. Signed-off-by: Pierre-Alexandre Meyer --- com32/hdt/hdt-cli-disk.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/com32/hdt/hdt-cli-disk.c b/com32/hdt/hdt-cli-disk.c index fec98a1..4e2994d 100644 --- a/com32/hdt/hdt-cli-disk.c +++ b/com32/hdt/hdt-cli-disk.c @@ -137,8 +137,13 @@ void main_show_disk(int argc, char **argv, remove_spaces(d->edd_params.host_bus_type), remove_spaces(d->edd_params.interface_type)); if (parse_partition_table(d, &show_partition_information)) { - fprintf(stderr, "Error parsing disk 0x%X\n", d->disk); - get_error("parse_partition_table"); + if (errno_disk) { + fprintf(stderr, "I/O error parsing disk 0x%X\n", d->disk); + get_error("parse_partition_table"); + } else { + fprintf(stderr, "Disk 0x%X: unrecognized partition layout\n", d->disk); + } + fprintf(stderr, "\n"); } } -- 2.7.4