hdt: enhance error reporting in the CLI (disk) syslinux-3.83-pre9
authorPierre-Alexandre Meyer <pierre@mouraf.org>
Sat, 22 Aug 2009 18:08:04 +0000 (11:08 -0700)
committerErwan Velu <erwan.velu@free.fr>
Mon, 24 Aug 2009 13:34:37 +0000 (15:34 +0200)
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 <pierre@mouraf.org>
com32/hdt/hdt-cli-disk.c

index fec98a1..4e2994d 100644 (file)
@@ -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");
        }
 }